/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.tour.controller;

import java.io.File;
import java.io.FileOutputStream;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.faces.event.ActionEvent;

import javax.faces.model.SelectItem;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.CellRangeAddress;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;
import queenb.net.entitybean.A000;
import queenb.net.entitybean.N100;
import queenb.net.entitybean.N750;
import queenb.net.entitybean.V050;
import queenb.net.entitybean.V200;
import queenb.net.entitybean.V220;
import queenb.net.entitybean.V500;
import queenb.web.controller.QueenbController;
import queenb.web.crm.store.CustomerStore;
import queenb.web.crm.store.V030Store;
import queenb.web.inteface.V500Inf;
import queenb.web.store.A000Store;
import queenb.web.store.N750Store;
import queenb.web.store.V050Store;
import queenb.web.store.V500Store;
import queenb.web.supplier.store.V220Store;
import queenb.web.util.*;

/**
 *
 * @author Cong Nguyen
 */
public class TourController extends QueenbController {

    private int fh000;
    private int pv500;
    private int pv050;
    private int fv050;
    private String fv051;
    private int fs200;
    private int fv200;//id han muc
    private String vv202;
    private String vv501;// ma tour
    private String vv502;// ten tour
    private String vv503;
    private String vv504;
    private String vv505;
    private String vv506;
    private String vv069; // Diem di
    private String vv070;// Diem den
    private String vv071;// mota
    private int vn072; // SL toi thieu
    private int vn507;//price
    private int vn508;//sl1
    private int vn509;//tt1
    private int vn510;//sl2
    private int vn511;//tt2
    private int vn512;//sl3
    private int vn513;//tt3
    private int vn514;//sl4
    private int vn515;//tt4
    private int fh200;
    private String fs400;
    private String fs410;
    private String fs420;
    private String fs430;
    private String fs440;
    private String fs450;
    private int val;
    private String label;
    //V050
    private String vv051;
    private String codeVv051;
    private String vv052;
    private int vn053;//slvn1
    private int vn054;//slvn1
    private int vn056;//slvn2
    private int vn057;//slvn2
    private int vn059;//slvn3
    private int vn060;//slvn3
    private int vn062;//slvn4
    private int vn063;//slvn4
    private int pv200;
    private int fk100;
    private String kv103;
    private int fk350;
    private String tt1;
    private String tt2;
    private String tt3;
    private String tt4;
    private String tong1;
    private String tong2;
    private String tong3;
    private String tong4;
    //price
    private double vn055;
    private double vn058;
    private double vn061;
    private double vn064;
    private String vn055St;
    private String vn058St;
    private String vn061St;
    private String vn064St;
    private double tong1bean = 0;
    private double tong2bean = 0;
    private double tong3bean = 0;
    private double tong4bean = 0;
    private double net1Bean = 0;
    private double net2Bean = 0;
    private double net3Bean = 0;
    private double net4Bean = 0;
    private double laigop1bean = 0;
    private double laigop2bean = 0;
    private double laigop3bean = 0;
    private double laigop4bean = 0;
    private double tongthu1bean = 0;
    private double tongthu2bean = 0;
    private double tongthu3bean = 0;
    private double tongthu4bean = 0;
    private double tile1bean = 0;
    private double tile2bean = 0;
    private double tile3bean = 0;
    private double tile4bean = 0;
    private String net1;
    private String net2;
    private String net3;
    private String net4;
    private String laigop1;
    private String laigop2;
    private String laigop3;
    private String laigop4;
    private String tongthu1;
    private String tongthu2;
    private String tongthu3;
    private String tongthu4;
    private String tile1;
    private String tile2;
    private String tile3;
    private String tile4;
    private int fv050Efect = 0;
    private boolean flagUpdate;
    private V500Inf tourInf;
    private V050Store v050Store;
    private String nameFk350;
    private String nameFV200;
    private boolean editRow;
    private List<V220> listsupplierofservice;
    private List<V220> listsupplierofserviceprice;
    private V500Store v500Store = new V500Store();
    ComboboxUtil comBoboxUtil = new ComboboxUtil();
    private String pageLoad = "";
    private int SV216;
    private List<V500> listItemAdd;
    private String message = "";
    private String fv050Str;
    private String desc;
    private boolean flagModifiy;
    private String vv067;
    private boolean flagCONTRO;
    private boolean flagCONFIR;
    private boolean flagCORRECT;
    private boolean flagAEU;
    private Date vd091;
    private String vv092;
    private Date vd093;
    private String vv094;
    public int vers;
    private int maxvers;
    private List<Object> listVersion;
    private List<V500> listVersionTour;
    private int country;// id quoc gia
    private static int city;// id tinh thanh
    private static int itemservice; // id dichj vu
    private int itemsupp;// id nha cung cap
    private int itemser;// id dich vu
    private List<A000> listcity;
    private List<V220> listsupplier;
    private List<V050> listTour;
    private String v065 = "OP";
    private String keySearch;
    private int typeSearch;
    private String status;
    private int iditemCC; // id nhac CC
    private List<SelectItem> listComboV220 = new ArrayList<SelectItem>();
    private Date vd073;
    private Date vd074;
    private List<N100> listSelectN100;//add khach hang vao tour
    private int pn100;
    private String flagaddTour;
    //paging
    private int Offset = 0;
    private int Limit = 30;
    private int totalrow; // tong so dong
    private int totalpage; // tong so trang
    private int current; // traung hien tai
    static private int numrow = 30; // so dong tren 1 trang
    private int start; // bat dau lay tu record
    private int end; // lay tu record so
    private int startpage = 1; // page bat dau
    private int endpage = 1;   // page ket thuc
    private String pagename = "";
    private int totalcurent;
    //tim kiem
    private List<SelectItem> cbxA000F;
    private List<SelectItem> cbxA000T;
    private List<SelectItem> cbxDays;
    private List<SelectItem> cbxMonths;
    private List<SelectItem> cbxYears;
    private List<SelectItem> cbxPrice = new ArrayList<SelectItem>();
    private List<SelectItem> cbxPricem = new ArrayList<SelectItem>();
    private int pnSDate;//ngay di
    private int pnSMonth;//thang di
    private int pnSYear;// nam di
    private int pnFA000F = 373;// noi di
    private int pnFA000T;// noi den
    private int pnFN750;// quoc gia
    private int pnVN055;//min price
    private int pnVN059;//max price
    private int pnVN079 = 0;//trong nuoc  0 ,ngoai nuoc 1
    private int flag = 0;
    private String priceTour;
    private String priceTourm;
    private int n750 = 1;
    private List<SelectItem> combN750 = new ArrayList<SelectItem>();
    private Boolean show = false;
    private Boolean showm = false;
    private List<V050> lstExportExcel = new ArrayList<V050>();
    private Workbook wb = new HSSFWorkbook();
    private int currentRow = 0;
    private SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    private String linklistTour;// link qua Tour for Dashboard
    private int idmenupersonal;// lay id de show mernu
    private boolean hideClass;// hide Class
    private boolean hideClassCT;// hide Class for action
    private int hideclassAction;
    private int hideclassActionCT;
    private String VV065;// Trang Thai Tour
    public TourController() {

        listSelectN100 = new ArrayList<N100>();
        try {
            listSelectN100 = (List<N100>) SessionProvider.getSessionMapValue(getKapiMenu().getListSelectedEx());
            if (listSelectN100.size() > 0) {
                getKapiMenu().setCheckList(true);
            } else {
                getKapiMenu().setCheckList(false);
            }
        } catch (Exception ex) {
        }
        getKapiMenu().setAdmin(false);
        getKapiMenu().setMainmenu1("m15"); // Hien thi Menu nao dc chon
        Object objFlagTour = getRequest().getParameter("flagaddTour");
        if (objFlagTour != null) {
            this.flagaddTour = objFlagTour.toString();
        }
        Object objPN100 = getRequest().getParameter("pn100");
        Object objPn100AddTour = SessionProvider.getSessionMapValue(getKapiMenu().getPn100St());
        if (objPN100 != null && objPn100AddTour == null) {
            this.pn100 = Integer.parseInt(objPN100.toString());
            SessionProvider.setSessionMapValue(getKapiMenu().getPn100St(), pn100);
        }

        if (objPn100AddTour != null) {
            this.pn100 = Integer.parseInt(objPn100AddTour.toString());
            getKapiMenu().setCheckList(true);
            flagaddTour = "noList";

        } else {
            getKapiMenu().setCheckList(false);
            flagaddTour = null;
        }

        System.out.print("--flag add tour----------" + flagaddTour + "--------------pns-----" + objPn100AddTour);
        SessionProvider.setSessionMapValue("flagUpdate", flagUpdate);
        Object pnPN100 = getRequest().getParameter("id");
        Object objPageLoad = getRequest().getParameter("page");

        Object sv216Object = getRequest().getParameter("SV216");
        Object objAction = getRequest().getParameter("action");

        //Kiem tra de redirec ve trang Chiet Tinh hay Danh sach tour
        Object objstatus = getRequest().getParameter("status");
        if (objstatus != null) {
            if (objstatus.toString().trim().equals("T")) {
                status = "T";
                SessionProvider.setSessionMapValue("status", status);
            } else if (objstatus.toString().trim().equals("C")) {
                status = "C";
                SessionProvider.setSessionMapValue("status", status);
            }
        }

        Object objFv050Tour = getRequest().getParameter("fv050");
        if (objFv050Tour != null) {
            this.fv050 = Integer.parseInt(objFv050Tour.toString());
        }
        Object objVV031 = getRequest().getParameter("vv031");
        if (objVV031 != null) {
            this.vv051 = objVV031.toString();
        }
        Object objVN055 = getRequest().getParameter("vn055");
        if (objVN055 != null) {
            this.vn055St = objVN055.toString();
        }

        if (getRequest().getParameter("action") != null) {
            String action = getRequest().getParameter("action");
            if (action.equals("add")) {
                SV216 = 1;
                SessionProvider.setSessionMapValue("tour_InOut", null);
            } else if (action.equals("edit")) {
                Object objPV500 = getRequest().getParameter("pv500");
                Object objFv050 = getRequest().getParameter("id");
                if (objPV500 != null) {
                    this.fv050 = Integer.parseInt(objPV500.toString());
                }
                if (objFv050 != null) {
                    this.fv050 = Integer.parseInt(objFv050.toString());
                }
                SV216 = 0;
                getV050Detail(fv050);
            } else if (action.equals("saveRowTour")) {
                Object objPV500 = getRequest().getParameter("pv500");

                if (objPV500 != null) {
                    this.pv500 = Integer.parseInt(objPV500.toString());

                }

                Object objFV200 = getRequest().getParameter("fv200");
                if (objFV200 != null) {
                    this.fv200 = Integer.parseInt(objFV200.toString());
                }

                Object objvv502 = getRequest().getParameter("vv502");
                if (objvv502 != null) {
                    this.vv502 = objvv502.toString();
                }
                Object objvn507 = getRequest().getParameter("vn507");
                if (objvn507 != null) {
                    this.vn507 = Integer.parseInt(objvn507.toString());
                }
                Object objfk100 = getRequest().getParameter("fk100");
                if (objfk100 != null) {
                    this.fk100 = Integer.parseInt(objfk100.toString());
                }

                Object objvn508 = getRequest().getParameter("vn508");
                if (objvn508 != null) {
                    this.vn508 = Integer.parseInt(objvn508.toString());
                }
                Object objvn510 = getRequest().getParameter("vn510");
                if (objvn510 != null) {
                    this.vn510 = Integer.parseInt(objvn510.toString());
                }
                Object objvn512 = getRequest().getParameter("vn512");
                if (objvn512 != null) {
                    this.vn512 = Integer.parseInt(objvn512.toString());
                }
                Object objvn514 = getRequest().getParameter("vn514");
                if (objvn514 != null) {
                    this.vn514 = Integer.parseInt(objvn514.toString());
                }
                Object objfv050 = getRequest().getParameter("fv050");
                if (objfv050 != null) {
                    this.fv050 = Integer.parseInt(objfv050.toString());
                }
                System.out.println("--save eidt--" + pv500);
                saveTour();
            } else if (action.equals("addPTour")) {
                if (pn100 > 0) {
                    getKapiMenu().setCheckList(true);
                } else {
                    getKapiMenu().setCheckList(false);
                }
            } else if (action.equals("showmenupersonal")) {
                Object idmenu = getRequest().getParameter("FV050");
                if (idmenu != null) {
                    idmenupersonal = Util.parseInt(idmenu);
                }
            } else if (action.equals("addCompany")) {
                Object objectPK100 = getRequest().getParameter("pk100");
                if (objectPK100 != null) {
                    fk100 = Util.parseInt(objectPK100);
                    SessionProvider.setSessionMapValue("IDADDTOURCOMPANY", fk100);
                    System.out.println("--------ABCCCCCCCCCCCCC---------" + SessionProvider.getSessionMapValue("IDADDTOURCOMPANY"));
                }
                if (fk100 > 0) {
                    getKapiMenu().setCheckListCompany(true);
                } else {
                    getKapiMenu().setCheckListCompany(false);
                }
            }



            Object objfv050 = getRequest().getParameter("fv050");
            if (objfv050 != null) {
                this.fv050 = Integer.parseInt(objfv050.toString());
                getV050Detail(fv050);
            }

            if (action.equals("deleteSessionTour")) {

                if (SessionProvider.getSessionMapValue("codetourselectID") != null) {
                    SessionProvider.removeSessionMapValue("codetourselectID");
                }
                if (SessionProvider.getSessionMapValue("typeSearchExx") != null) {
                    SessionProvider.removeSessionMapValue("typeSearchExx");
                }
//                if (SessionProvider.getSessionMapValue("IDADDTOURCOMPANY") != null) {
//                    SessionProvider.removeSessionMapValue("IDADDTOURCOMPANY");
//                    getKapiMenu().setCheckListCompany(false);
//                }
                Object typeObject = getRequest().getParameter("typeS");
                if (typeObject != null) {
                    typeSearch = Util.parseInt(typeObject);
                }

                System.out.println("--------------TYPE SRESSH==" + typeSearch);



            } else if (action.equals("deleteSessionTourTT")) {
                if (SessionProvider.getSessionMapValue("IDADDTOURCOMPANY") != null) {
                    SessionProvider.removeSessionMapValue("IDADDTOURCOMPANY");
                    getKapiMenu().setCheckListCompany(false);
                }
            }
            if (action.equals("linkrecord")) {
                //  Object objfv050 = getRequest().getParameter("fv050");
                if (SessionProvider.getSessionMapValue("codetourselectID") != null) {
                    SessionProvider.removeSessionMapValue("codetourselectID");
                }
                if (objfv050 != null) {
                    this.fv050 = Integer.parseInt(objfv050.toString());


                }
                Object linkTourObject = getRequest().getParameter("tabel");
                if (linkTourObject != null) {
                    this.linklistTour = linkTourObject.toString();
                }
                setTypeSearch(200);
                System.out.println(typeSearch+"------------>>fv050.." + fv050 + "---- link--" + linklistTour);
              
            }
            if (action.equals("deleteTour")) {
                Object objPV500 = getRequest().getParameter("pv500");
                Object objFV050 = getRequest().getParameter("fv050");
                if (objFV050 != null) {
                    this.fv050 = Integer.parseInt(objFV050.toString());
                }
                if (objPV500 != null) {
                    this.pv500 = Integer.parseInt(objPV500.toString());
                }
            }
            if (action.equals("targetTour")) {
                Object objVersion = getRequest().getParameter("vers");
                if (objVersion != null) {
                    this.vers = Integer.parseInt(objVersion.toString());
                    System.out.println("--------verion--------------------" + objVersion);
                }
            }

            if (action.equals("service")) {
                Object idcountry = getRequest().getParameter("id");
                if (idcountry != null) {
                    this.country = Integer.parseInt(idcountry.toString());

                    listcity = getListCityAll(country);

                }
            }

            if (action.equals("getIDservice")) {
                System.out.print("----- Id lay tu======================= dich vu do vao)");
                Object idcountry = getRequest().getParameter("pv220");
                if (idcountry != null) {
                    this.pv200 = Integer.parseInt(idcountry.toString());
                    SessionProvider.setSessionMapValue("PV220", pv200);
                    System.out.println("----- Id lay tu dich vu do vao action-----" + pv200);

                }
            }

            if (action.equals("servicesupplier")) {
                Object idicity = getRequest().getParameter("id");
                if (idicity != null) {
                    this.city = Integer.parseInt(idicity.toString());

                    listsupplier = getListsupplierforcity(city);

                }
            }
            if (action.equals("serviceprice")) {
                Object idicity = getRequest().getParameter("id");
                Object idicity1 = getRequest().getParameter("pk100");
                if (idicity != null && idicity1 != null) {
                    itemsupp = Integer.parseInt(idicity1.toString());
                    this.itemser = Integer.parseInt(idicity.toString());
                    System.out.print("--------id cua dichj vu===" + itemser);
                    listComboV220 = getListComBV220(itemser, itemsupp);
                    listsupplierofserviceprice = getListservicePrice(itemser, itemsupp);

                }
            }
            if (action.equals("serviceend")) {
                Object idicity = getRequest().getParameter("id");
                if (idicity != null) {
                    this.itemsupp = Integer.parseInt(idicity.toString());
                    SessionProvider.setSessionMapValue("NCC", itemsupp);
                    System.out.print("----------------iddddddddddddddddddddddddd serviceaaaaa" + itemsupp);
                    listsupplierofservice = getListservice(itemsupp);

                }
            }
            if (action.equals("serviceitem")) {
                Object iditemservice = getRequest().getParameter("id");
                if (iditemservice != null) {
                    this.itemservice = Integer.parseInt(iditemservice.toString());


                }
            }



        }
        if (objPageLoad != null) {
            this.pageLoad = objPageLoad.toString();
            System.out.println("page load --------------" + objPageLoad);
        }
        if (pnPN100 != null) {
            this.fk350 = Integer.parseInt(pnPN100.toString());
        }
        Object objPV050 = getRequest().getParameter("pv050");
        if (objPV050 != null) {
            this.pv050 = Integer.parseInt(objPV050.toString());
            System.out.println("---------------------pv050--------------" + objPV050);
        }
        Object objFS200 = getRequest().getParameter("fs200");

        if (objFS200 != null) {

            this.fs200 = Integer.parseInt(objFS200.toString());
            Object action = getRequest().getParameter("action");
            if (action != null && (action.equals("linktour"))) {
            }
        }

        //paging
        int a;
        Object ppage = getRequest().getParameter("p");
        if (ppage != null) {
            try {
                a = Integer.parseInt(ppage.toString());
            } catch (Exception ex) {
                a = 1;
            }
            if (a == 1) {
                setCurrent(1);
                setOffset(0);
            } else {
                setCurrent(a);
                setOffset((a - 1) * Limit);
            }

        } else {
            SessionProvider.setSessionMapValue("typeSearchTOUR", null);
            SessionProvider.setSessionMapValue("keySearchTOUR", null);
            setCurrent(1);
            setOffset(0);
        }


    }

    // hide Class
    public void hideClassABC(ActionEvent ev) {
        try {
            System.out.println("----HIDE CLASS----------------------------------------" + hideClass);
            System.out.println("----HIDE CLASS----------------------------------------" + hideClassCT);
            SessionProvider.setSessionMapValue("HIDECLASS", hideClass);
            SessionProvider.setSessionMapValue("HIDECLASSCT", hideClassCT);
        } catch (Exception e) {
        }
    }

    // tim kiem 
    public void reload() {
        try {

            SessionProvider.setSessionMapValue("typeSearchExx", typeSearch);
            SessionProvider.setSessionMapValue("keySearchExx", keySearch);
        } catch (Exception e) {
        }
    }
    // DANH SAHCH TIM KIEM TRANH THAI THEO TOUR
    // TIm Status trong List Tour

    public void reloadStatus() {
        try {
            System.out.println("---------VV065-----"+VV065);
             SessionProvider.setSessionMapValue("STRINGSTATUSVV065", VV065);
            SessionProvider.setSessionMapValue("typeSearchExx", 100);
            String dateStart = ContextUtil.getRequestParameter("leavedate111");
            if (dateStart != null) {
                setVd073(Util.parseDate(dateStart, "dd/MM/yyyy"));
            } else {
                // setNd118(null);
            }
            String dateStart1 = ContextUtil.getRequestParameter("leavedate112");

            if (dateStart != null) {
                setVd074(Util.parseDate(dateStart1, "dd/MM/yyyy"));

            } else {
                // setNd118(null);
            }
            System.out.println("----GET DATE FOR SEARCH STATUS IN TOUR------" + vd073 + vd074);
        } catch (Exception e) {
        }
    }

    public void updateaddCompanyTour() {
        try {
            CustomerStore customerStore = new CustomerStore();

            Object object = getRequest().getParameter("fv050");
            if (object != null) {
                fv050 = Util.parseInt(object);
            }
            if (SessionProvider.getSessionMapValue("IDADDTOURCOMPANY") != null) {
                int rs = customerStore.updateColumnN100(null, "V050", "FK100", String.valueOf(Util.parseInt(SessionProvider.getSessionMapValue("IDADDTOURCOMPANY"))), "PV050", fv050, getLogin().getUserName());
                if (rs > 0) {

                    sendRedirectUrlTab("listTour.jsp?action=addCompany&pk100=" + Util.parseInt(SessionProvider.getSessionMapValue("IDADDTOURCOMPANY")));
                    showGlobalReport(true, getResourceString("datasavesuccessful"));


                } else {
                    sendRedirectUrlTab("listTour.jsp?action=addCompany&pk100=" + Util.parseInt(SessionProvider.getSessionMapValue("IDADDTOURCOMPANY")));
                    showGlobalReport(true, getResourceString("datasuccessfail"));

                }
                System.out.println("---------- PARAMS TUNG -----------" + fv050 + SessionProvider.getSessionMapValue("IDADDTOURCOMPANY"));


                System.out.println("---------- RESULT TUNG -" + rs);
            } else {
                sendRedirectUrlTab("listTour.jsp?action=addCompany&pk100=" + fk100);
                showGlobalReport(true, getResourceString("datasuccessfail"));
            }

        } catch (Exception e) {
        }
    }

    //autocomplete
    public List<V500> autocomplete(Object suggest) {
        String pref = suggest.toString().toLowerCase();
        System.out.print("--------------" + pref);
        ArrayList<V500> result = new ArrayList<V500>();

        Iterator<V500> iterator = comBoboxUtil.getListV500().iterator();
        while (iterator.hasNext()) {
            V500 elem = (V500) iterator.next();
            System.out.print("===============" + elem.getLabel());
            if (elem.getLabel() != null && ("".equals(pref) || elem.getLabel().toLowerCase().contains(pref))) {
                result.add(elem);
            }
        }
        return result;
    }

    //Hien thi danh sach danh muc
    public List<SelectItem> getListItemV200() {

        List<SelectItem> lstItemV200 = comBoboxUtil.getListComBV200();

        return lstItemV200;
    }
    //Hien thi danh sach code tour

    public List<SelectItem> getListItemS200() {
        return comBoboxUtil.getListCombS200();
    }
    //hien thi danh sach nha cung cap

    public List<SelectItem> getListItemK100() {
        return comBoboxUtil.getListCombK100();
    }

//    public void editAction(V500Model item) {
//        System.out.println("---------edit---+i" + item.getPv500());
//        item.setEditRow(true);
//
//    }
    public void editAction() {
        System.out.println("------------------0000----------------------");
        setEditRow(true);
    }

    public List<SelectItem> getListCombV050SGT() {
        return comBoboxUtil.getListCombV050SGT();
    }

    public void saveEditRow() {
    }

    public void getV050Detail(int fv050) {
        List<V050> lst = getListV050SGT();
        if (lst != null) {
            if (lst.size() > 0) {
                for (int i = 0; i < lst.size(); i++) {
                    if (lst.get(i).getFv050() == fv050) {
                        this.vv052 = lst.get(i).getVv052();
                        this.vv051 = lst.get(i).getVv051();
                        this.fv050 = lst.get(i).getFv050();
                        this.vv069 = lst.get(i).getVv069();
                        this.vv070 = lst.get(i).getVv070();
                        this.vv071 = lst.get(i).getVv071();
                        this.vn072 = lst.get(i).getVn072();
                        this.vd073 = lst.get(i).getVd073();
                        this.vd074 = lst.get(i).getVd074();
                        break;
                    }
                }
            }
        }

    }

    public void updateV050() {
        try {
            System.out.println("-------------fv050news----------------" + fv050 + "--ppage load-- " + pageLoad);
            this.vn055 = Util.convertStringToDouble(this.getVn055St());
            this.vn058 = Util.convertStringToDouble(this.getVn058St());
            this.vn061 = Util.convertStringToDouble(this.getVn061St());
            this.vn064 = Util.convertStringToDouble(this.getVn064St());
            Object objAction = getRequest().getParameter("action");
            String dateStart = ContextUtil.getRequestParameter("to");
            String dateEnd = ContextUtil.getRequestParameter("from");
            if (dateStart != null) {
                setVd073(Util.parseDate(dateStart, "dd/MM/yyyy"));
            } else {
                setVd073(null);
            }
            if (dateEnd != null) {
                setVd074(Util.parseDate(dateEnd, "dd/MM/yyyy"));
            } else {
                setVd074(null);
            }
            if (objAction != null) {
                if (objAction.equals("updateRowTour") && this.getFv050() > 0) {
                    int update = tourInf.updateV050(this.getFv050(), this.getLogin().getModule(), getLogin().getCompanyNo(),
                            this.getFs200(), this.getVv051(), this.getVv052(), this.getVn053(), this.getVn054(),
                            this.getVn055(), this.getVn056(), this.getVn057(), this.getVn058(), this.getVn059(),
                            this.getVn060(), this.getVn061(), this.getVn062(), this.getVn063(), this.getVn064(), null, "T", this.getVv069(), this.getVv070(), this.getVv071(), getVn072(), Util.toSQLDate(getVd073()), Util.toSQLDate(getVd074()), getLogin().getUserName());
                    sendRedirectUrlTab(pageLoad + "?action=linkrecord&fv050=" + fv050 + "&" + Util.convertMD5(getRequest().getRequestURI()));
                    showGlobalReport(true, getResourceString("datasavesuccessful"));
                } else {
                    sendRedirectUrlTab(pageLoad + "?action=linkrecord&fv050=" + fv050 + "&" + Util.convertMD5(getRequest().getRequestURI()));
                    showGlobalReport(true, getResourceString("datasuccessfail"));
                }
            } else if (pageLoad.equals("managerSale.jsp")) {
                int update = tourInf.updateV050(0, this.getLogin().getModule(), getLogin().getCompanyNo(),
                        0, vv051, vv052, 0, 0,
                        Util.convertStringToDouble("0"), 0, 0, Util.convertStringToDouble("0"), 0,
                        0, Util.convertStringToDouble("0"), 0, 0, Util.convertStringToDouble("0"), this.v065, "S", vv069, vv070, getVv071(), getVn072(), Util.toSQLDate(getVd073()), Util.toSQLDate(getVd074()), getLogin().getUserName());
                if (update >= 0) {

                    sendRedirect(pageLoad);
                    showGlobalReport(true, getResourceString("datasavesuccessful"));

                }
            } else {
                int update = tourInf.updateV050(this.getFv050(), this.getLogin().getModule(), getLogin().getCompanyNo(),
                        this.getFs200(), this.getVv051(), this.getVv052(), this.getVn053(), this.getVn054(),
                        this.getVn055(), this.getVn056(), this.getVn057(), this.getVn058(), this.getVn059(),
                        this.getVn060(), this.getVn061(), this.getVn062(), this.getVn063(), this.getVn064(), null, "T", this.getVv069(), this.getVv070(), this.getVv071(), getVn072(), Util.toSQLDate(getVd073()), Util.toSQLDate(getVd074()), getLogin().getUserName());
                if (update >= 0) {

                    sendRedirectUrlTab(pageLoad + "?tab=header6&" + Util.convertMD5(getRequest().getRequestURI()));
                    showGlobalReport(true, getResourceString("datasavesuccessful"));

                }
            }

        } catch (Exception e) {
            System.out.println("D: error from updateV050: " + e.getMessage());
            sendRedirect(pageLoad);
            showGlobalReport(true, getResourceString("datasuccessfail"));
        }



    }

    public void deleteTour() {
        try {
            Object objPV500 = getRequest().getParameter("pv500");
            Object objFV050 = getRequest().getParameter("fv050");
            System.out.println("----------------ffv050---->>>" + objFV050);
            if (objFV050 != null) {
                this.fv050 = Integer.parseInt(objFV050.toString());
            }
            if (objPV500 != null) {
                this.pv500 = Integer.parseInt(objPV500.toString());
            }
            v500Store.deleteV500By(this.pv500, getLogin().getUserName());
            sendRedirectUrlTab("managerTour.jsp?action=linkrecord&fv050=" + fv050 + "&linkTour=" + Util.convertMD5(getRequest().getRequestURI()));
            showGlobalReport(true, getResourceString("datasavesuccessful"));
            listItemAdd = getListV500(fv050);

        } catch (Exception ex) {
        }


    }

    public List<V500> getListItemAdd() {

        if (listItemAdd != null && listItemAdd.size() > 0) {
            Iterator iterator = listItemAdd.iterator();
            while (iterator.hasNext()) {
                V500 item = (V500) iterator.next();
                this.vv052 = item.getVv052();
                this.vv502 = item.getVv502();
                this.vn053 = item.getVn053();
                this.vv503 = item.getVv503();
                this.vn054 = item.getVn054();
                this.vv504 = item.getVv504();
                this.vn057 = item.getVn057();
                this.vn507 = item.getVn507();
                this.vn056 = item.getVn056();
                this.vn059 = item.getVn059();
                this.vn060 = item.getVn060();
                this.vn062 = item.getVn062();
                this.vn063 = item.getVn063();
                // this.vn055 = item.getVn055();

                //price
                this.vn055 = item.getVn055();
                this.vn058 = item.getVn058();
                this.vn508 = item.getVn508();
                this.vn061 = item.getVn061();
                this.vn064 = item.getVn064();

                if (item.getVn055() > 0) {
                    this.vn055St = Util.numberformater(Double.valueOf(String.valueOf(item.getVn055())), "##,###,###");
                }
                if (item.getVn058() > 0) {
                    this.vn058St = Util.numberformater(Double.valueOf(String.valueOf(item.getVn058())), "##,###,###");
                }
                if (item.getVn061() > 0) {
                    this.vn061St = Util.numberformater(Double.valueOf(String.valueOf(item.getVn061())), "##,###,###");
                }

                if (item.getVn064() > 0) {
                    this.vn064St = Util.numberformater(Double.valueOf(String.valueOf(item.getVn064())), "##,###,###");
                }
                //
                //this.vn058 = item.getVn058();
                this.vn508 = item.getVn508();
                // this.vn061 = item.getVn061();
                // this.vn064 = item.getVn064();
                this.fv050 = item.getFv050();
                this.pv500 = item.getPv500();
                this.fv200 = item.getFv200();
                this.fk100 = item.getFk100();
                this.vn510 = item.getVn510();
                this.vn511 = item.getVn511();
                this.vn512 = item.getVn512();
                this.vn513 = item.getVn513();
                this.vn514 = item.getVn514();
                this.vn515 = item.getVn515();
                this.vv067 = item.getVv067();
                this.vd091 = item.getVd091();
                this.vv092 = item.getVv092();
                this.vd093 = item.getVd093();
                this.vv094 = item.getVv094();
                this.vers = item.getVers();
                if (this.vers > 0) {
                    listVersion = new ArrayList<Object>();
                    for (int i = 1; i <= vers; i++) {
                        Object objIn = i;
                        listVersion.add(objIn);
                    }
                }
                System.out.println("=----vv067---" + this.getVv067() + "=====" + vers);
                if (this.vv067 != null) {
                    if (this.vv067.toLowerCase().equals("o")) {

                        this.flagAEU = true;
                        this.flagCONFIR = true;//f
                        this.flagCONTRO = true;//k
                        this.flagCORRECT = true;//m
                    } else if (this.vv067.toLowerCase().equals("k")) {
                        System.out.println("-kkkkkkkkkkkkkk--");
                        this.flagAEU = true;
                        this.flagCONTRO = false;
                        this.flagCORRECT = true;
                        this.flagCONFIR = true;
                    } else if (this.vv067.toLowerCase().equals("f")) {
                        System.out.println("-ffffffffff--");
                        this.flagAEU = false;
                        this.flagCONTRO = false;
                        this.flagCORRECT = true;
                        this.flagCONFIR = false;
                    }
                } else {
                    this.flagAEU = true;
                    this.flagCONFIR = true;
                    this.flagCONTRO = true;
                    this.flagCORRECT = true;
                }

                tong1bean = tong1bean + item.getVn509();
                tong2bean = tong2bean + item.getVn511();
                tong3bean = tong3bean + item.getVn513();
                tong4bean = tong4bean + item.getVn515();

                if (this.getVn053() != 0) {
                    net1Bean = tong1bean / this.getVn053();
                } else {
                    net1Bean = 0;

                }
                if (this.getVn056() != 0) {
                    net2Bean = tong2bean / this.getVn056();
                } else {
                    net2Bean = 0;

                }
                if (this.getVn059() != 0) {
                    net3Bean = tong3bean / this.getVn059();
                } else {
                    net3Bean = 0;

                }
                if (this.getVn062() != 0) {
                    net4Bean = tong4bean / this.getVn062();
                } else {
                    net4Bean = 0;

                }


                laigop1bean = (item.getVn055() - net1Bean) * item.getVn053();
                laigop2bean = (item.getVn058() - net2Bean) * item.getVn056();
                laigop3bean = (item.getVn061() - net3Bean) * item.getVn059();
                laigop4bean = (item.getVn064() - net4Bean) * item.getVn062();


                tongthu1bean = item.getVn055() * item.getVn053();
                tongthu2bean = item.getVn058() * item.getVn056();
                tongthu3bean = item.getVn061() * item.getVn059();
                tongthu4bean = item.getVn064() * item.getVn062();


                if (tongthu1bean != 0) {
                    tile1bean = laigop1bean / tongthu1bean * 100;
                } else {
                    tile1bean = 0;
                }
                if (tongthu2bean != 0) {
                    tile2bean = laigop2bean / tongthu2bean * 100;
                } else {
                    tile2bean = 0;
                }
                if (tongthu3bean != 0) {
                    tile3bean = laigop3bean / tongthu3bean * 100;
                } else {
                    tile3bean = 0;
                }
                if (tongthu4bean != 0) {
                    tile4bean = laigop4bean / tongthu4bean * 100;
                } else {
                    tile4bean = 0;
                }

                setNet1(Util.numberformater(net1Bean, "##,###,###"));
                setNet2(Util.numberformater(net2Bean, "#,###,###"));
                setNet3(Util.numberformater(net3Bean, "#,###,###"));
                setNet4(Util.numberformater(net4Bean, "#,###,###"));

                setLaigop1(Util.numberformater(laigop1bean, "##,###,###"));
                setLaigop2(Util.numberformater(laigop2bean, "#,###,###"));
                setLaigop3(Util.numberformater(laigop3bean, "#,###,###"));
                setLaigop4(Util.numberformater(laigop4bean, "#,###,###"));

                setTile1(Util.numberformater(tile1bean, "#.###"));
                setTile2(Util.numberformater(tile2bean, "#.###"));
                setTile3(Util.numberformater(tile3bean, "#.###"));
                setTile4(Util.numberformater(tile4bean, "#.###"));

                setTong1(Util.numberformater(tong1bean, "##,###,###"));
                setTong2(Util.numberformater(tong2bean, "#,###,###"));
                setTong3(Util.numberformater(tong3bean, "#,###,###"));
                setTong4(Util.numberformater(tong4bean, "#,###,###"));

                setTongthu1(Util.numberformater(tongthu1bean, "##,###,###"));
                setTongthu2(Util.numberformater(tongthu2bean, "#,###,###"));
                setTongthu3(Util.numberformater(tongthu3bean, "#,###,###"));
                setTongthu4(Util.numberformater(tongthu4bean, "#,###,###"));
            }
        } else {

            this.vn057 = 0;
            this.vn507 = 0;
            this.vn056 = 0;
            this.vn054 = 0;
            this.vn059 = 0;
            this.vn060 = 0;
            this.vn062 = 0;
            this.vn063 = 0;
            this.vn055 = 0;
            this.vn058 = 0;
            this.vn508 = 0;
            this.vn061 = 0;
            this.vn064 = 0;
            this.vn510 = 0;
            this.vn511 = 0;
            this.vn512 = 0;
            this.vn513 = 0;
            this.vn514 = 0;
            this.vn515 = 0;
            this.vn053 = 0;
            this.vn055St = "0";
            this.vn058St = "0";
            this.vn061St = "0";
            this.vn064St = "0";
            this.flagAEU = true;
            this.flagCONFIR = true;//f
            this.flagCONTRO = true;//k
            this.flagCORRECT = true;//m
        }

        return listItemAdd;
    }

    public List<V050> getListV050SGT() {
        try {
            v050Store = new V050Store();
            List<V050> lst = v050Store.getListAllV050SGTN(getLogin().getModule(), getLogin().getCompanyNo(), 0, null, null, null, getLogin().getUserName());

            return lst;
        } catch (Exception e) {
            return null;
        }

    }
    //Hien thi danh sach tour da tao san

    public void actionListenner() {
        // SessionProvider.setSessionMapValue("fv050D",fv050);
        listItemAdd = getListV500(this.getFv050());

        List<V500> listItem = v500Store.getListCombV050SGT(getLogin().getModule(), getLogin().getCompanyNo(), null, "T", getLogin().getUserName());
        if (listItem != null) {
            Iterator iterator = listItem.iterator();
            while (iterator.hasNext()) {
                V500 item = (V500) iterator.next();
                if (this.getFv050() == item.getVal()) {
                    setDesc(item.getVv052());

                    break;
                }
            }
        }
    }

    public List<V500> getListV500(int fv050) {
        try {
            List<V500> listV500 = v500Store.getListV500ByFS200(getLogin().getModule(), getLogin().getCompanyNo(), this.getFv050(), fs200, getLogin().getUserName());

            return listV500;
        } catch (Exception ex) {
            return null;
        }
    }

    //save tour
    public void saveTour() {
        int roweffect = 0;

        Iterator itemfv200 = comBoboxUtil.getListComBV200().iterator();
        while (itemfv200.hasNext()) {
            SelectItem item = (SelectItem) itemfv200.next();
            if (this.getFv200() == item.getValue()) {
                this.vv503 = item.getLabel().toString();
            }
        }
        Iterator itK100 = getListItemK100().iterator();
        while (itK100.hasNext()) {
            SelectItem itemK100 = (SelectItem) itK100.next();

            //System.out.println("---so sanh " +this.getFk350()+"== " + itemK100.getValue()+"lable"+itemK100.getLabel());    
            if (this.getFk100() == Integer.parseInt(itemK100.getValue().toString())) {
                this.vv504 = itemK100.getLabel().toString();
            }

        }
        double tt1Bean = this.getVn508() * this.getVn507();
        double tt2Bean = this.getVn510() * this.getVn507();
        double tt3Bean = this.getVn512() * this.getVn507();
        double tt4Bean = this.getVn514() * this.getVn507();
        if (fv050 != 0) {
            setMessage("");
            System.out.println("-----save tour---" + this.getPv500() + "," + getLogin().getModule() + "," + getLogin().getCompanyNo() + ","
                    + this.getFv050() + "," + this.getFs200() + ","
                    + this.getFv200() + "," + this.fk100 + "," + this.getVv501() + "," + this.getVv502() + ","
                    + this.getVv503() + "," + this.getVv504() + "," + this.getVv505() + "," + this.getVv506() + ","
                    + this.getVn507() + "," + this.getVn508() + "," + tt1Bean + "," + this.getVn510() + ","
                    + tt2Bean + "," + this.getVn512() + "," + tt3Bean + "," + this.getVn514() + ","
                    + tt4Bean + "," + this.fs400 + "," + this.getFs410() + "," + this.getFs420() + ","
                    + this.getFs430() + "," + this.getFs440() + "," + this.getFs450() + "," + getLogin().getUserName());


            int idPV220 = Util.parseInt(SessionProvider.getSessionMapValue("PV220"));
            int idPnFk100 = Util.parseInt(SessionProvider.getSessionMapValue("NCC"));
            System.out.println("-----TUNGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG-------------" + idPV220);
            roweffect = v500Store.updateV500By(this.getPv500(), getLogin().getModule(), getLogin().getCompanyNo(),
                    this.getFv050(), idPV220,
                    this.getFv200(), idPnFk100, this.getVv501(), this.getVv502(),
                    this.getVv503(), this.getVv504(), this.getVv505(), this.getVv506(),
                    this.getVn507(), this.getVn508(), tt1Bean, this.getVn510(),
                    tt2Bean, this.getVn512(), tt3Bean, this.getVn514(),
                    tt4Bean, this.fs400, this.getFs410(), this.getFs420(),
                    this.getFs430(), this.getFs440(), this.getFs450(), getLogin().getUserName());

            listItemAdd = getListV500(this.getFv050());
        } else {
            setMessage(getResourceString("pleaseTour"));
        }


    }

    public List<V500> getListVersionTour() {
        try {
            if (listVersionTour == null) {
                listVersionTour = v500Store.getListV500R(getLogin().getModule(), getLogin().getCompanyNo(), this.getFv050(), this.getVers(), getLogin().getUserName());
            }
            if (listVersionTour != null && listVersionTour.size() > 0) {
                Iterator iterator = listVersionTour.iterator();
                while (iterator.hasNext()) {
                    V500 item = (V500) iterator.next();
                    this.vv052 = item.getVv052();
                    this.vv502 = item.getVv502();
                    this.vn053 = item.getVn053();
                    this.vv503 = item.getVv503();
                    this.vn054 = item.getVn054();
                    this.vv504 = item.getVv504();
                    this.vn057 = item.getVn057();
                    this.vn507 = item.getVn507();
                    this.vn056 = item.getVn056();
                    this.vn059 = item.getVn059();
                    this.vn060 = item.getVn060();
                    this.vn062 = item.getVn062();
                    this.vn063 = item.getVn063();
                    this.vv051 = item.getVv051();
                    setCodeVv051(item.getVv051());
                    this.codeVv051 = item.getVv051();
                    System.out.println("-----vv051----------" + codeVv051);
                    //price
                    this.vn055 = item.getVn055();
                    this.vn058 = item.getVn058();
                    this.vn508 = item.getVn508();
                    this.vn061 = item.getVn061();
                    this.vn064 = item.getVn064();

                    if (item.getVn055() > 0) {
                        this.vn055St = Util.numberformater(Double.valueOf(String.valueOf(item.getVn055())), "##,###,###");
                    }
                    if (item.getVn058() > 0) {
                        this.vn058St = Util.numberformater(Double.valueOf(String.valueOf(item.getVn058())), "##,###,###");
                    }
                    if (item.getVn061() > 0) {
                        this.vn061St = Util.numberformater(Double.valueOf(String.valueOf(item.getVn061())), "##,###,###");
                    }

                    if (item.getVn064() > 0) {
                        this.vn064St = Util.numberformater(Double.valueOf(String.valueOf(item.getVn064())), "##,###,###");
                    }



                    //
                    this.fv050 = item.getFv050();
                    this.pv500 = item.getPv500();
                    this.fv200 = item.getFv200();
                    this.fk100 = item.getFk100();
                    this.vn510 = item.getVn510();
                    this.vn511 = item.getVn511();
                    this.vn512 = item.getVn512();
                    this.vn513 = item.getVn513();
                    this.vn514 = item.getVn514();
                    this.vn515 = item.getVn515();
                    this.vv067 = item.getVv067();
                    this.vd091 = item.getVd091();
                    this.vv092 = item.getVv092();
                    this.vd093 = item.getVd093();
                    this.vv094 = item.getVv094();
                    this.maxvers = item.getMaxvers();
                    if (this.maxvers > 0) {
                        listVersion = new ArrayList<Object>();
                        for (int i = 1; i <= maxvers; i++) {
                            Object objIn = i;
                            listVersion.add(objIn);
                        }
                    }
                    System.out.println("=----vv067---" + this.getVv067() + "=====" + vers);
                    if (this.vv067 != null) {
                        if (this.vv067.toLowerCase().equals("o")) {

                            this.flagAEU = true;
                            this.flagCONFIR = true;//f
                            this.flagCONTRO = true;//k
                            this.flagCORRECT = true;//m
                        } else if (this.vv067.toLowerCase().equals("k")) {
                            System.out.println("-kkkkkkkkkkkkkk--");
                            this.flagAEU = true;
                            this.flagCONTRO = false;
                            this.flagCORRECT = true;
                            this.flagCONFIR = true;
                        } else if (this.vv067.toLowerCase().equals("f")) {
                            System.out.println("-ffffffffff--");
                            this.flagAEU = false;
                            this.flagCONTRO = false;
                            this.flagCORRECT = true;
                            this.flagCONFIR = false;
                        }
                    } else {
                        this.flagAEU = true;
                        this.flagCONFIR = true;
                        this.flagCONTRO = true;
                        this.flagCORRECT = true;
                    }

                    tong1bean = tong1bean + item.getVn509();
                    tong2bean = tong2bean + item.getVn511();
                    tong3bean = tong3bean + item.getVn513();
                    tong4bean = tong4bean + item.getVn515();

                    if (this.getVn053() != 0) {
                        net1Bean = tong1bean / this.getVn053();
                    } else {
                        net1Bean = 0;

                    }
                    if (this.getVn056() != 0) {
                        net2Bean = tong2bean / this.getVn056();
                    } else {
                        net2Bean = 0;

                    }
                    if (this.getVn059() != 0) {
                        net3Bean = tong3bean / this.getVn059();
                    } else {
                        net3Bean = 0;

                    }
                    if (this.getVn062() != 0) {
                        net4Bean = tong4bean / this.getVn062();
                    } else {
                        net4Bean = 0;

                    }


                    laigop1bean = (item.getVn055() - net1Bean) * item.getVn053();
                    laigop2bean = (item.getVn058() - net2Bean) * item.getVn056();
                    laigop3bean = (item.getVn061() - net3Bean) * item.getVn059();
                    laigop4bean = (item.getVn064() - net4Bean) * item.getVn062();


                    tongthu1bean = item.getVn055() * item.getVn053();
                    tongthu2bean = item.getVn058() * item.getVn056();
                    tongthu3bean = item.getVn061() * item.getVn059();
                    tongthu4bean = item.getVn064() * item.getVn062();


                    if (tongthu1bean != 0) {
                        tile1bean = laigop1bean / tongthu1bean * 100;
                    } else {
                        tile1bean = 0;
                    }
                    if (tongthu2bean != 0) {
                        tile2bean = laigop2bean / tongthu2bean * 100;
                    } else {
                        tile2bean = 0;
                    }
                    if (tongthu3bean != 0) {
                        tile3bean = laigop3bean / tongthu3bean * 100;
                    } else {
                        tile3bean = 0;
                    }
                    if (tongthu4bean != 0) {
                        tile4bean = laigop4bean / tongthu4bean * 100;
                    } else {
                        tile4bean = 0;
                    }

                    setNet1(Util.numberformater(net1Bean, "##,###,###"));
                    setNet2(Util.numberformater(net2Bean, "#,###,###"));
                    setNet3(Util.numberformater(net3Bean, "#,###,###"));
                    setNet4(Util.numberformater(net4Bean, "#,###,###"));

                    setLaigop1(Util.numberformater(laigop1bean, "##,###,###"));
                    setLaigop2(Util.numberformater(laigop2bean, "#,###,###"));
                    setLaigop3(Util.numberformater(laigop3bean, "#,###,###"));
                    setLaigop4(Util.numberformater(laigop4bean, "#,###,###"));

                    setTile1(Util.numberformater(tile1bean, "#.###"));
                    setTile2(Util.numberformater(tile2bean, "#.###"));
                    setTile3(Util.numberformater(tile3bean, "#.###"));
                    setTile4(Util.numberformater(tile4bean, "#.###"));

                    setTong1(Util.numberformater(tong1bean, "##,###,###"));
                    setTong2(Util.numberformater(tong2bean, "#,###,###"));
                    setTong3(Util.numberformater(tong3bean, "#,###,###"));
                    setTong4(Util.numberformater(tong4bean, "#,###,###"));

                    setTongthu1(Util.numberformater(tongthu1bean, "##,###,###"));
                    setTongthu2(Util.numberformater(tongthu2bean, "#,###,###"));
                    setTongthu3(Util.numberformater(tongthu3bean, "#,###,###"));
                    setTongthu4(Util.numberformater(tongthu4bean, "#,###,###"));

                    System.out.println("----code tour" + codeVv051);
                }
            } else {

                this.vn057 = 0;
                this.vn507 = 0;
                this.vn056 = 0;
                this.vn054 = 0;
                this.vn059 = 0;
                this.vn060 = 0;
                this.vn062 = 0;
                this.vn063 = 0;
                this.vn055 = 0;
                this.vn058 = 0;
                this.vn508 = 0;
                this.vn061 = 0;
                this.vn064 = 0;
                this.vn510 = 0;
                this.vn511 = 0;
                this.vn512 = 0;
                this.vn513 = 0;
                this.vn514 = 0;
                this.vn515 = 0;
                this.vn053 = 0;
                this.flagAEU = true;
                this.flagCONFIR = true;//f
                this.flagCONTRO = true;//k
                this.flagCORRECT = true;//m
            }
            System.out.println("----code tour" + codeVv051);
            return listVersionTour;
        } catch (Exception ex) {
            return null;
        }

    }
// Star code 27/09/2012 - Kiem duyet tour

    public void checkTour() {
        System.out.println("----check fvo50----" + this.getFv050());
        if (this.getFv050() != 0) {
            v500Store.CONTROTABV050(this.getFv050(), getLogin().getUserName());

            sendRedirectUrlTab(pageLoad + "?action=linkrecord&fv050=" + fv050 + "&" + Util.convertMD5(getRequest().getRequestURI()));
            showGlobalReport(true, getResourceString("datasavesuccessful"));

        } else {
            //sendRedirect("managerTour.jsp");
            sendRedirectUrlTab(pageLoad + "?action=linkrecord&fv050=" + fv050 + "&" + Util.convertMD5(getRequest().getRequestURI()));
            showGlobalReport(true, getResourceString("datasuccessfail"));
        }
    }

    public void checkConfirTour() {
        System.out.println("----check fvo50----" + this.getFv050());
        if (this.getFv050() != 0) {
            int roweffect = v500Store.CONFIRTABV050(this.getFv050(), getLogin().getUserName());
            if (roweffect >= 0) {
                this.flagCONFIR = false;
                sendRedirectUrlTab(pageLoad + "?action=linkrecord&fv050=" + fv050 + "&" + Util.convertMD5(getRequest().getRequestURI()));
                showGlobalReport(true, getResourceString("datasavesuccessful"));
            }

        } else {
            sendRedirectUrlTab(pageLoad + "?action=linkrecord&fv050=" + fv050 + "&" + Util.convertMD5(getRequest().getRequestURI()));
            showGlobalReport(true, getResourceString("datasuccessfail"));
        }
    }
    //modify

    public void CORRECTTABV050() {
        this.vn055 = Util.convertStringToDouble(this.getVn055St());
        this.vn058 = Util.convertStringToDouble(this.getVn058St());
        this.vn061 = Util.convertStringToDouble(this.getVn061St());
        this.vn064 = Util.convertStringToDouble(this.getVn064St());
        System.out.println("---" + this.getFv050() + "," + this.getLogin().getModule() + "," + getLogin().getCompanyNo() + ","
                + this.getFs200() + "," + this.getVv051() + "," + this.getVv052() + "," + this.getVn053() + "," + this.getVn054() + ","
                + this.getVn055() + "," + this.getVn056() + "," + this.getVn057() + "," + this.getVn058() + "," + this.getVn059() + ","
                + this.getVn060() + "," + this.getVn061() + "," + this.getVn062() + "," + this.getVn063() + "," + this.getVn064() + "," + null + "," + "T" + "," + getLogin().getUserName());
        int roweffect = tourInf.CORRECTTABV050(this.getFv050(), this.getLogin().getModule(), getLogin().getCompanyNo(),
                this.getFs200(), this.getVv051(), this.getVv052(), this.getVn053(), this.getVn054(),
                this.getVn055(), this.getVn056(), this.getVn057(), this.getVn058(), this.getVn059(),
                this.getVn060(), this.getVn061(), this.getVn062(), this.getVn063(), this.getVn064(), null, "T", getLogin().getUserName());

        if (roweffect >= 0) {
            sendRedirectUrlTab(pageLoad + "?action=linkrecord&fv050=" + fv050 + "&" + Util.convertMD5(getRequest().getRequestURI()));
            showGlobalReport(true, getResourceString("datasavesuccessful"));
        } else {
            sendRedirectUrlTab(pageLoad + "?action=linkrecord&fv050=" + fv050 + "&" + Util.convertMD5(getRequest().getRequestURI()));
            showGlobalReport(true, getResourceString("datasuccessfail"));
        }

    }

    // TUng start
    public List<N750> getListCountAll() {
        N750Store n750Store = new N750Store();
        try {
            List<N750> listCombT075 = n750Store.findAllN750ForAll(0, getLogin().getUserName());
            return listCombT075;
        } catch (Exception e) {
            return null;
        }
    }

    public List<A000> getListCityAll(int id) {
        A000Store store = new A000Store();
        try {
            List<A000> listS200 = store.findAllA000Forcountry(id, getLogin().getUserName());
            return listS200;
        } catch (Exception e) {
            return null;
        }
    }

    public List<V220> getListsupplierforcity(int id) {
        V220Store store = new V220Store();
        try {
            List<V220> listsuplier = store.findAllV220Forsupplier(getLogin().getModule(), getLogin().getCompanyNo(), id, itemservice, getLogin().getUserName());
            return listsuplier;
        } catch (Exception e) {
            return null;
        }
    }
    // ham lay dich vu end

    public List<V220> getListservice(int id) {
        V220Store store = new V220Store();
        try {

            List<V220> listsuplier = store.findAllV220Forsupplierandservice(getLogin().getModule(), getLogin().getCompanyNo(), itemservice, city, id, getLogin().getUserName());
            System.err.println("---------------ffffffff-------" + listsuplier.size());
            return listsuplier;
        } catch (Exception e) {
            return null;
        }
    }

    public List<V220> getListservicePrice(int id, int id1) {
        V220Store store = new V220Store();
        try {


            System.err.println("---------------777777777777-------" + getLogin().getModule() + "," + getLogin().getCompanyNo() + "," + city + "," + id1 + "," + id + "," + getLogin().getUserName());
            List<V220> listsuplier = store.findAllV220ForPrice(getLogin().getModule(), getLogin().getCompanyNo(), city, id1, id, getLogin().getUserName());
            System.err.println("---------------day la gia cua service-------" + listsuplier.size() + "===" + listsuplier.get(0).getVn228());
            return listsuplier;
        } catch (Exception e) {
            return null;
        }
    }

    public List<SelectItem> getListComBV220(int id, int id1) {
        V220Store v220Store = new V220Store();
        List<SelectItem> listItem = new ArrayList<SelectItem>();
        try {
            List<V220> listv200 = v220Store.findAllV220Combo(getLogin().getModule(), getLogin().getCompanyNo(), city, id1, id, getLogin().getUserName());
            Iterator ic = listv200.iterator();
            while (ic.hasNext()) {
                V200 v200 = (V200) ic.next();
                SelectItem item = new SelectItem(v200.getVal(), v200.getLabel());
                listItem.add(item);

            }
            return listItem;
        } catch (Exception ex) {
            return null;
        }
    }
    // Tung End

    //add KH theo tour
    public void removeSessionTour() {
        SessionProvider.setSessionMapValue(getKapiMenu().getListSelectedEx(), null);
        getKapiMenu().setCheckList(false);
    }

    public void addTourCus() throws SQLException, InstantiationException, IllegalAccessException {
        System.out.println("-------fv050 kh-------" + fv050 + "---" + vv051 + "---" + vn055St + "-------" + flagaddTour + "---" + pn100);

        if (flagaddTour.equals("noList")) {
            System.out.println("----vao no list---fv050 kh-------" + fv050 + "---" + vv051 + "---" + vn055St + "-------" + flagaddTour + "---" + pn100);
            V030Store v030ST = new V030Store();
            int roweffect = v030ST.updateV030(fv050, this.getPn100(), this.getVv051(), null, Util.convertStringToDouble(vn055St), null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, getLogin().getUserName());
            if (roweffect > 0) {
                showGlobalReport(true, getResourceString("success"));
                flagaddTour = null;
                SessionProvider.setSessionMapValue(getKapiMenu().getPn100St(), null);
                getKapiMenu().setCheckList(false);
                sendRedirect("listTour.jsp?" + getKapiMenu().getMd5url());

            } else {
                showGlobalReport(true, getResourceString("error"));
                sendRedirect("listTour.jsp?" + getKapiMenu().getMd5url());
            }
        } else {
            List<N100> listN100 = (List<N100>) SessionProvider.getSessionMapValue(getKapiMenu().getListSelectedEx());
            if (listN100 != null) {
                if (listN100.size() > 0) {
                    Iterator iterator = listN100.iterator();
                    while (iterator.hasNext()) {
                        V030Store v030ST = new V030Store();
                        N100 n100 = (N100) iterator.next();
                        v030ST.updateV030(fv050, n100.pn100, this.getVv051(), null, Util.convertStringToDouble(vn055St), null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, getLogin().getUserName());

                    }

                    showGlobalReport(true, getResourceString("success"));
                    sendRedirect("listTour.jsp?" + getKapiMenu().getMd5url());
                    SessionProvider.setSessionMapValue(getKapiMenu().getListSelectedEx(), null);
                    getKapiMenu().setCheckList(false);
                } else {
                    showGlobalReport(true, getResourceString("error"));
                    sendRedirect("listTour.jsp?" + getKapiMenu().getMd5url());
                }
            }
        }

    }

    public void changeCountry(ActionEvent ac) {
        setFlag(getFlag() + 1);
        System.out.println("D:---change Country " + n750);
        SessionProvider.setSessionMapValue("n750Tour", n750);

    }

    /**
     * @return the fh000
     */
    public int getFh000() {
        return fh000;
    }

    /**
     * @param fh000 the fh000 to set
     */
    public void setFh000(int fh000) {
        this.fh000 = fh000;
    }

    /**
     * @return the pv500
     */
    public int getPv500() {
        return pv500;
    }

    /**
     * @param pv500 the pv500 to set
     */
    public void setPv500(int pv500) {
        this.pv500 = pv500;
    }

    /**
     * @return the pv050
     */
    public int getPv050() {
        return pv050;
    }

    /**
     * @param pv050 the pv050 to set
     */
    public void setPv050(int pv050) {
        this.pv050 = pv050;
    }

    /**
     * @return the fv050
     */
    public int getFv050() {
//        Object obj  = SessionProvider.getSessionMapValue("fv050D");
//        if(obj!= null){
//            try{
//                fv050 = Integer.parseInt(obj.toString());
//                
//            }catch(Exception e){
//                
//            }
//            
//        }
        return fv050;
    }

    /**
     * @param fv050 the fv050 to set
     */
    public void setFv050(int fv050) {
        this.fv050 = fv050;
    }

    /**
     * @return the fs200
     */
    public int getFs200() {
        return fs200;
    }

    /**
     * @param fs200 the fs200 to set
     */
    public void setFs200(int fs200) {
        this.fs200 = fs200;
    }

    /**
     * @return the fv200
     */
    public int getFv200() {
        return fv200;
    }

    /**
     * @param fv200 the fv200 to set
     */
    public void setFv200(int fv200) {
        this.fv200 = fv200;
    }

    /**
     * @return the vv202
     */
    public String getVv202() {
        return vv202;
    }

    /**
     * @param vv202 the vv202 to set
     */
    public void setVv202(String vv202) {
        this.vv202 = vv202;
    }

    /**
     * @return the vv501
     */
    public String getVv501() {
        return vv501;
    }

    /**
     * @param vv501 the vv501 to set
     */
    public void setVv501(String vv501) {
        this.vv501 = vv501;
    }

    /**
     * @return the vv502
     */
    public String getVv502() {
        return vv502;
    }

    /**
     * @param vv502 the vv502 to set
     */
    public void setVv502(String vv502) {
        this.vv502 = vv502;
    }

    /**
     * @return the vv503
     */
    public String getVv503() {
        return vv503;
    }

    /**
     * @param vv503 the vv503 to set
     */
    public void setVv503(String vv503) {
        this.vv503 = vv503;
    }

    /**
     * @return the vv504
     */
    public String getVv504() {
        return vv504;
    }

    /**
     * @param vv504 the vv504 to set
     */
    public void setVv504(String vv504) {
        this.vv504 = vv504;
    }

    /**
     * @return the vv505
     */
    public String getVv505() {
        return vv505;
    }

    /**
     * @param vv505 the vv505 to set
     */
    public void setVv505(String vv505) {
        this.vv505 = vv505;
    }

    /**
     * @return the vv506
     */
    public String getVv506() {
        return vv506;
    }

    /**
     * @param vv506 the vv506 to set
     */
    public void setVv506(String vv506) {
        this.vv506 = vv506;
    }

    /**
     * @return the vn507
     */
    public int getVn507() {
        return vn507;
    }

    /**
     * @param vn507 the vn507 to set
     */
    public void setVn507(int vn507) {
        this.vn507 = vn507;
    }

    /**
     * @return the vn508
     */
    public int getVn508() {
        return vn508;
    }

    /**
     * @param vn508 the vn508 to set
     */
    public void setVn508(int vn508) {
        this.vn508 = vn508;
    }

    /**
     * @return the vn509
     */
    public int getVn509() {
        return vn509;
    }

    /**
     * @param vn509 the vn509 to set
     */
    public void setVn509(int vn509) {
        this.vn509 = vn509;
    }

    /**
     * @return the vn510
     */
    public int getVn510() {
        return vn510;
    }

    /**
     * @param vn510 the vn510 to set
     */
    public void setVn510(int vn510) {
        this.vn510 = vn510;
    }

    /**
     * @return the vn511
     */
    public int getVn511() {
        return vn511;
    }

    /**
     * @param vn511 the vn511 to set
     */
    public void setVn511(int vn511) {
        this.vn511 = vn511;
    }

    /**
     * @return the vn512
     */
    public int getVn512() {
        return vn512;
    }

    /**
     * @param vn512 the vn512 to set
     */
    public void setVn512(int vn512) {
        this.vn512 = vn512;
    }

    /**
     * @return the vn513
     */
    public int getVn513() {
        return vn513;
    }

    /**
     * @param vn513 the vn513 to set
     */
    public void setVn513(int vn513) {
        this.vn513 = vn513;
    }

    /**
     * @return the vn514
     */
    public int getVn514() {
        return vn514;
    }

    /**
     * @param vn514 the vn514 to set
     */
    public void setVn514(int vn514) {
        this.vn514 = vn514;
    }

    /**
     * @return the vn515
     */
    public int getVn515() {
        return vn515;
    }

    /**
     * @param vn515 the vn515 to set
     */
    public void setVn515(int vn515) {
        this.vn515 = vn515;
    }

    /**
     * @return the fh200
     */
    public int getFh200() {
        return fh200;
    }

    /**
     * @param fh200 the fh200 to set
     */
    public void setFh200(int fh200) {
        this.fh200 = fh200;
    }

    /**
     * @return the fs400
     */
    public String getFs400() {
        return fs400;
    }

    /**
     * @param fs400 the fs400 to set
     */
    public void setFs400(String fs400) {
        this.fs400 = fs400;
    }

    /**
     * @return the fs410
     */
    public String getFs410() {
        return fs410;
    }

    /**
     * @param fs410 the fs410 to set
     */
    public void setFs410(String fs410) {
        this.fs410 = fs410;
    }

    /**
     * @return the fs420
     */
    public String getFs420() {
        return fs420;
    }

    /**
     * @param fs420 the fs420 to set
     */
    public void setFs420(String fs420) {
        this.fs420 = fs420;
    }

    /**
     * @return the fs430
     */
    public String getFs430() {
        return fs430;
    }

    /**
     * @param fs430 the fs430 to set
     */
    public void setFs430(String fs430) {
        this.fs430 = fs430;
    }

    /**
     * @return the fs440
     */
    public String getFs440() {
        return fs440;
    }

    /**
     * @param fs440 the fs440 to set
     */
    public void setFs440(String fs440) {
        this.fs440 = fs440;
    }

    /**
     * @return the fs450
     */
    public String getFs450() {
        return fs450;
    }

    /**
     * @param fs450 the fs450 to set
     */
    public void setFs450(String fs450) {
        this.fs450 = fs450;
    }

    /**
     * @return the val
     */
    public int getVal() {
        return val;
    }

    /**
     * @param val the val to set
     */
    public void setVal(int val) {
        this.val = val;
    }

    /**
     * @return the label
     */
    public String getLabel() {
        return label;
    }

    /**
     * @param label the label to set
     */
    public void setLabel(String label) {
        this.label = label;
    }

    /**
     * @return the vv051
     */
    public String getVv051() {
        return vv051;
    }

    /**
     * @param vv051 the vv051 to set
     */
    public void setVv051(String vv051) {
        this.vv051 = vv051;
    }

    /**
     * @return the vv052
     */
    public String getVv052() {
        return vv052;
    }

    /**
     * @param vv052 the vv052 to set
     */
    public void setVv052(String vv052) {
        this.vv052 = vv052;
    }

    /**
     * @return the vn053
     */
    public int getVn053() {
        return vn053;
    }

    /**
     * @param vn053 the vn053 to set
     */
    public void setVn053(int vn053) {
        this.vn053 = vn053;
    }

    /**
     * @return the vn054
     */
    public int getVn054() {
        return vn054;
    }

    /**
     * @param vn054 the vn054 to set
     */
    public void setVn054(int vn054) {
        this.vn054 = vn054;
    }

    /**
     * @return the vn055
     */
    public double getVn055() {
        return vn055;
    }

    /**
     * @param vn055 the vn055 to set
     */
    public void setVn055(double vn055) {
        this.vn055 = vn055;
    }

    /**
     * @return the vn056
     */
    public int getVn056() {
        return vn056;
    }

    /**
     * @param vn056 the vn056 to set
     */
    public void setVn056(int vn056) {
        this.vn056 = vn056;
    }

    /**
     * @return the vn057
     */
    public int getVn057() {
        return vn057;
    }

    /**
     * @param vn057 the vn057 to set
     */
    public void setVn057(int vn057) {
        this.vn057 = vn057;
    }

    /**
     * @return the vn058
     */
    public double getVn058() {
        return vn058;
    }

    /**
     * @param vn058 the vn058 to set
     */
    public void setVn058(double vn058) {
        this.vn058 = vn058;
    }

    /**
     * @return the vn059
     */
    public int getVn059() {
        return vn059;
    }

    /**
     * @param vn059 the vn059 to set
     */
    public void setVn059(int vn059) {
        this.vn059 = vn059;
    }

    /**
     * @return the vn060
     */
    public int getVn060() {
        return vn060;
    }

    /**
     * @param vn060 the vn060 to set
     */
    public void setVn060(int vn060) {
        this.vn060 = vn060;
    }

    /**
     * @return the vn061
     */
    public double getVn061() {
        return vn061;
    }

    /**
     * @param vn061 the vn061 to set
     */
    public void setVn061(double vn061) {
        this.vn061 = vn061;
    }

    /**
     * @return the vn062
     */
    public int getVn062() {
        return vn062;
    }

    /**
     * @param vn062 the vn062 to set
     */
    public void setVn062(int vn062) {
        this.vn062 = vn062;
    }

    /**
     * @return the vn063
     */
    public int getVn063() {
        return vn063;
    }

    /**
     * @param vn063 the vn063 to set
     */
    public void setVn063(int vn063) {
        this.vn063 = vn063;
    }

    /**
     * @return the vn064
     */
    public double getVn064() {
        return vn064;
    }

    /**
     * @param vn064 the vn064 to set
     */
    public void setVn064(double vn064) {
        this.vn064 = vn064;
    }

    /**
     * @return the pv200
     */
    public int getPv200() {
        return pv200;
    }

    /**
     * @param pv200 the pv200 to set
     */
    public void setPv200(int pv200) {
        this.pv200 = pv200;
    }

    /**
     * @return the fk100
     */
    public int getFk100() {
        return fk100;
    }

    /**
     * @param fk100 the fk100 to set
     */
    public void setFk100(int fk100) {
        this.fk100 = fk100;
    }

    /**
     * @return the kv103
     */
    public String getKv103() {
        return kv103;
    }

    /**
     * @param kv103 the kv103 to set
     */
    public void setKv103(String kv103) {
        this.kv103 = kv103;
    }

    /**
     * @return the fk350
     */
    public int getFk350() {
        Object obj = SessionProvider.getSessionMapValue("fk350D");
        if (obj != null) {
            try {
                fk350 = Integer.parseInt(obj.toString());
            } catch (Exception e) {
            }
        }

        return fk350;
    }

    /**
     * @param fk350 the fk350 to set
     */
    public void setFk350(int fk350) {
        this.fk350 = fk350;
    }

    /**
     * @return the listItemAdd
     */
    /**
     * @param listItemAdd the listItemAdd to set
     */
    public void setListItemAdd(List<V500> listItemAdd) {
        this.listItemAdd = listItemAdd;
    }

    /**
     * @return the tong1
     */
    public String getTong1() {
        return tong1;
    }

    /**
     * @param tong1 the tong1 to set
     */
    public void setTong1(String tong1) {
        this.tong1 = tong1;
    }

    /**
     * @return the tong2
     */
    public String getTong2() {
        return tong2;
    }

    /**
     * @param tong2 the tong2 to set
     */
    public void setTong2(String tong2) {
        this.tong2 = tong2;
    }

    /**
     * @return the tong3
     */
    public String getTong3() {
        return tong3;
    }

    /**
     * @param tong3 the tong3 to set
     */
    public void setTong3(String tong3) {
        this.tong3 = tong3;
    }

    /**
     * @return the tong4
     */
    public String getTong4() {
        return tong4;
    }

    /**
     * @param tong4 the tong4 to set
     */
    public void setTong4(String tong4) {
        this.tong4 = tong4;
    }

    /**
     * @return the net1
     */
    public String getNet1() {
        return net1;
    }

    /**
     * @param net1 the net1 to set
     */
    public void setNet1(String net1) {
        this.net1 = net1;
    }

    /**
     * @return the net2
     */
    public String getNet2() {
        return net2;
    }

    /**
     * @param net2 the net2 to set
     */
    public void setNet2(String net2) {
        this.net2 = net2;
    }

    /**
     * @return the net3
     */
    public String getNet3() {
        return net3;
    }

    /**
     * @param net3 the net3 to set
     */
    public void setNet3(String net3) {
        this.net3 = net3;
    }

    /**
     * @return the net4
     */
    public String getNet4() {
        return net4;
    }

    /**
     * @param net4 the net4 to set
     */
    public void setNet4(String net4) {
        this.net4 = net4;
    }

    /**
     * @return the laigop1
     */
    public String getLaigop1() {
        return laigop1;
    }

    /**
     * @param laigop1 the laigop1 to set
     */
    public void setLaigop1(String laigop1) {
        this.laigop1 = laigop1;
    }

    /**
     * @return the laigop2
     */
    public String getLaigop2() {
        return laigop2;
    }

    /**
     * @param laigop2 the laigop2 to set
     */
    public void setLaigop2(String laigop2) {
        this.laigop2 = laigop2;
    }

    /**
     * @return the laigop3
     */
    public String getLaigop3() {
        return laigop3;
    }

    /**
     * @param laigop3 the laigop3 to set
     */
    public void setLaigop3(String laigop3) {
        this.laigop3 = laigop3;
    }

    /**
     * @return the laigop4
     */
    public String getLaigop4() {
        return laigop4;
    }

    /**
     * @param laigop4 the laigop4 to set
     */
    public void setLaigop4(String laigop4) {
        this.laigop4 = laigop4;
    }

    /**
     * @return the tongthu1
     */
    public String getTongthu1() {
        return tongthu1;
    }

    /**
     * @param tongthu1 the tongthu1 to set
     */
    public void setTongthu1(String tongthu1) {
        this.tongthu1 = tongthu1;
    }

    /**
     * @return the tongthu2
     */
    public String getTongthu2() {
        return tongthu2;
    }

    /**
     * @param tongthu2 the tongthu2 to set
     */
    public void setTongthu2(String tongthu2) {
        this.tongthu2 = tongthu2;
    }

    /**
     * @return the tongthu3
     */
    public String getTongthu3() {
        return tongthu3;
    }

    /**
     * @param tongthu3 the tongthu3 to set
     */
    public void setTongthu3(String tongthu3) {
        this.tongthu3 = tongthu3;
    }

    /**
     * @return the tongthu4
     */
    public String getTongthu4() {
        return tongthu4;
    }

    /**
     * @param tongthu4 the tongthu4 to set
     */
    public void setTongthu4(String tongthu4) {
        this.tongthu4 = tongthu4;
    }

    /**
     * @return the tile1
     */
    public String getTile1() {
        return tile1;
    }

    /**
     * @param tile1 the tile1 to set
     */
    public void setTile1(String tile1) {
        this.tile1 = tile1;
    }

    /**
     * @return the tile2
     */
    public String getTile2() {
        return tile2;
    }

    /**
     * @param tile2 the tile2 to set
     */
    public void setTile2(String tile2) {
        this.tile2 = tile2;
    }

    /**
     * @return the tile3
     */
    public String getTile3() {
        return tile3;
    }

    /**
     * @param tile3 the tile3 to set
     */
    public void setTile3(String tile3) {
        this.tile3 = tile3;
    }

    /**
     * @return the tile4
     */
    public String getTile4() {
        return tile4;
    }

    /**
     * @param tile4 the tile4 to set
     */
    public void setTile4(String tile4) {
        this.tile4 = tile4;
    }

    /**
     * @return the tourInf
     */
    public V500Inf getTourInf() {
        return tourInf;
    }

    /**
     * @param tourInf the tourInf to set
     */
    public void setTourInf(V500Inf tourInf) {
        this.tourInf = tourInf;
    }

    /**
     * @return the fv050Efect
     */
    public int getFv050Efect() {
        fv050Efect = Integer.parseInt(SessionProvider.getSessionMapValue("fv050Efect").toString());
        return fv050Efect;
    }

    /**
     * @param fv050Efect the fv050Efect to set
     */
    public void setFv050Efect(int fv050Efect) {
        this.fv050Efect = fv050Efect;
    }

    /**
     * @return the flagUpdate
     */
    public boolean isFlagUpdate() {

        return flagUpdate;
    }

    /**
     * @param flagUpdate the flagUpdate to set
     */
    public void setFlagUpdate(boolean flagUpdate) {
        this.flagUpdate = flagUpdate;
    }

    /**
     * @return the tt1
     */
    public String getTt1() {
        return tt1;
    }

    /**
     * @param tt1 the tt1 to set
     */
    public void setTt1(String tt1) {
        this.tt1 = tt1;
    }

    /**
     * @return the tt2
     */
    public String getTt2() {
        return tt2;
    }

    /**
     * @param tt2 the tt2 to set
     */
    public void setTt2(String tt2) {
        this.tt2 = tt2;
    }

    /**
     * @return the tt3
     */
    public String getTt3() {
        return tt3;
    }

    /**
     * @param tt3 the tt3 to set
     */
    public void setTt3(String tt3) {
        this.tt3 = tt3;
    }

    /**
     * @return the tt4
     */
    public String getTt4() {
        return tt4;
    }

    /**
     * @param tt4 the tt4 to set
     */
    public void setTt4(String tt4) {
        this.tt4 = tt4;
    }

    /**
     * @return the nameFk350
     */
    public String getNameFk350() {
        return nameFk350;
    }

    /**
     * @param nameFk350 the nameFk350 to set
     */
    public void setNameFk350(String nameFk350) {
        this.nameFk350 = nameFk350;
    }

    /**
     * @return the nameFV200
     */
    public String getNameFV200() {
        return nameFV200;
    }

    /**
     * @param nameFV200 the nameFV200 to set
     */
    public void setNameFV200(String nameFV200) {
        this.nameFV200 = nameFV200;
    }

    /**
     * @return the pageLoad
     */
    public String getPageLoad() {
        return pageLoad;
    }

    /**
     * @param pageLoad the pageLoad to set
     */
    public void setPageLoad(String pageLoad) {
        this.pageLoad = pageLoad;
    }

    /**
     * @return the editRow
     */
    public boolean isEditRow() {
        return editRow;
    }

    /**
     * @param editRow the editRow to set
     */
    public void setEditRow(boolean editRow) {
        this.editRow = editRow;
    }

    /**
     * @return the message
     */
    public String getMessage() {
        return message;
    }

    /**
     * @param message the message to set
     */
    public void setMessage(String message) {
        this.message = message;
    }

    /**
     * @return the fv050Str
     */
    public String getFv050Str() {
        return fv050Str;
    }

    /**
     * @param fv050Str the fv050Str to set
     */
    public void setFv050Str(String fv050Str) {

        this.fv050Str = fv050Str;
    }

    /**
     * @return the desc
     */
    public String getDesc() {
        return desc;
    }

    /**
     * @param desc the desc to set
     */
    public void setDesc(String desc) {
        this.desc = desc;
    }

    /**
     * @return the flagModifiy
     */
    public boolean isFlagModifiy() {
        return flagModifiy;
    }

    /**
     * @param flagModifiy the flagModifiy to set
     */
    public void setFlagModifiy(boolean flagModifiy) {
        this.flagModifiy = flagModifiy;
    }

    /**
     * @return the vv067
     */
    public String getVv067() {
        return vv067;
    }

    /**
     * @param vv067 the vv067 to set
     */
    public void setVv067(String vv067) {
        this.vv067 = vv067;
    }

    /**
     * @return the flagCONTRO
     */
    public boolean isFlagCONTRO() {
        return flagCONTRO;
    }

    /**
     * @param flagCONTRO the flagCONTRO to set
     */
    public void setFlagCONTRO(boolean flagCONTRO) {
        this.flagCONTRO = flagCONTRO;
    }

    /**
     * @return the flagCONFIR
     */
    public boolean isFlagCONFIR() {
        return flagCONFIR;
    }

    /**
     * @param flagCONFIR the flagCONFIR to set
     */
    public void setFlagCONFIR(boolean flagCONFIR) {
        this.flagCONFIR = flagCONFIR;
    }

    /**
     * @return the flagCORRECT
     */
    public boolean isFlagCORRECT() {
        return flagCORRECT;
    }

    /**
     * @param flagCORRECT the flagCORRECT to set
     */
    public void setFlagCORRECT(boolean flagCORRECT) {
        this.flagCORRECT = flagCORRECT;
    }

    /**
     * @return the flagAEU
     */
    public boolean isFlagAEU() {
        return flagAEU;
    }

    /**
     * @param flagAEU the flagAEU to set
     */
    public void setFlagAEU(boolean flagAEU) {
        this.flagAEU = flagAEU;
    }

    /**
     * @return the vd091
     */
    public Date getVd091() {
        return vd091;
    }

    /**
     * @param vd091 the vd091 to set
     */
    public void setVd091(Date vd091) {
        this.vd091 = vd091;
    }

    /**
     * @return the vv092
     */
    public String getVv092() {
        return vv092;
    }

    /**
     * @param vv092 the vv092 to set
     */
    public void setVv092(String vv092) {
        this.vv092 = vv092;
    }

    /**
     * @return the vd093
     */
    public Date getVd093() {
        return vd093;
    }

    /**
     * @param vd093 the vd093 to set
     */
    public void setVd093(Date vd093) {
        this.vd093 = vd093;
    }

    /**
     * @return the vv094
     */
    public String getVv094() {
        return vv094;
    }

    /**
     * @param vv094 the vv094 to set
     */
    public void setVv094(String vv094) {
        this.vv094 = vv094;
    }

    /**
     * @return the vers
     */
    public int getVers() {


        return vers;
    }

    /**
     * @param vers the vers to set
     */
    public void setVers(int vers) {
        this.vers = vers;
    }

    /**
     * @return the listVersion
     */
    public List<Object> getListVersion() {
        return listVersion;
    }

    /**
     * @param listVersion the listVersion to set
     */
    public void setListVersion(List<Object> listVersion) {
        this.listVersion = listVersion;
    }

    /**
     * @param listVersionTour the listVersionTour to set
     */
    public void setListVersionTour(List<V500> listVersionTour) {
        this.setListVersionTour(listVersionTour);
    }

    /**
     * @return the maxvers
     */
    public int getMaxvers() {
        return maxvers;
    }

    /**
     * @param maxvers the maxvers to set
     */
    public void setMaxvers(int maxvers) {
        this.maxvers = maxvers;
    }

    /**
     * @return the vn055St
     */
    public String getVn055St() {
        return vn055St;
    }

    /**
     * @param vn055St the vn055St to set
     */
    public void setVn055St(String vn055St) {
        this.vn055St = vn055St;
    }

    /**
     * @return the vn058St
     */
    public String getVn058St() {
        return vn058St;
    }

    /**
     * @param vn058St the vn058St to set
     */
    public void setVn058St(String vn058St) {
        this.vn058St = vn058St;
    }

    /**
     * @return the vn061St
     */
    public String getVn061St() {
        return vn061St;
    }

    /**
     * @param vn061St the vn061St to set
     */
    public void setVn061St(String vn061St) {
        this.vn061St = vn061St;
    }

    /**
     * @return the vn064St
     */
    public String getVn064St() {
        return vn064St;
    }

    /**
     * @param vn064St the vn064St to set
     */
    public void setVn064St(String vn064St) {
        this.vn064St = vn064St;
    }

    /**
     * @return the codeVv051
     */
    public String getCodeVv051() {
        System.out.println("----code tour" + codeVv051);
        return codeVv051;
    }

    /**
     * @param codeVv051 the codeVv051 to set
     */
    public void setCodeVv051(String codeVv051) {
        this.codeVv051 = codeVv051;
    }

    /**
     * @return the country
     */
    public int getCountry() {
        return country;
    }

    /**
     * @param country the country to set
     */
    public void setCountry(int country) {
        this.country = country;
    }

    /**
     * @return the listcity
     */
    public List<A000> getListcity() {
        return listcity;
    }

    /**
     * @param listcity the listcity to set
     */
    public void setListcity(List<A000> listcity) {
        this.listcity = listcity;
    }

    /**
     * @return the itemservice
     */
    public int getItemservice() {
        return itemservice;
    }

    /**
     * @param itemservice the itemservice to set
     */
    public void setItemservice(int itemservice) {
        this.itemservice = itemservice;
    }

    /**
     * @return the city
     */
    public int getCity() {
        return city;
    }

    /**
     * @param city the city to set
     */
    public void setCity(int city) {
        this.city = city;
    }

    /**
     * @return the listsupplier
     */
    public List<V220> getListsupplier() {
        return listsupplier;
    }

    /**
     * @param listsupplier the listsupplier to set
     */
    public void setListsupplier(List<V220> listsupplier) {
        this.listsupplier = listsupplier;
    }

    /**
     * @return the itemsupp
     */
    public int getItemsupp() {
        return itemsupp;
    }

    /**
     * @param itemsupp the itemsupp to set
     */
    public void setItemsupp(int itemsupp) {
        this.itemsupp = itemsupp;
    }

    /**
     * @return the listsupplierofservice
     */
    public List<V220> getListsupplierofservice() {
        return listsupplierofservice;
    }

    /**
     * @param listsupplierofservice the listsupplierofservice to set
     */
    public void setListsupplierofservice(List<V220> listsupplierofservice) {
        this.listsupplierofservice = listsupplierofservice;
    }

    /**
     * @return the vv069
     */
    public String getVv069() {
        return vv069;
    }

    /**
     * @param vv069 the vv069 to set
     */
    public void setVv069(String vv069) {
        this.vv069 = vv069;
    }

    /**
     * @return the vv070
     */
    public String getVv070() {
        return vv070;
    }

    /**
     * @param vv070 the vv070 to set
     */
    public void setVv070(String vv070) {
        this.vv070 = vv070;
    }

    public void actionSearch(ActionEvent ac) {
        setFlag(getFlag() + 1);
        System.out.println("------------in 0 out 1--" + getPnVN079());
        SessionProvider.setSessionMapValue("tour_InOut", pnVN079);
        SessionProvider.setSessionMapValue("n750Tour", "0");
        SessionProvider.setSessionMapValue("tour_to", "0");



    }

    public void actionDay(ActionEvent ac) {
        setFlag(getFlag() + 1);
        System.out.println("------------pnSDate--" + pnSDate);
        SessionProvider.setSessionMapValue("tour_day", pnSDate);

    }

    public void actionMonth(ActionEvent ac) {
        setFlag(getFlag() + 1);
        System.out.println("------------pnSMonth--" + pnSMonth);
        SessionProvider.setSessionMapValue("tour_month", pnSMonth);

    }

    public void actionYear(ActionEvent ac) {
        setFlag(getFlag() + 1);
        System.out.println("------------pnSYear--" + pnSYear);
        SessionProvider.setSessionMapValue("tour_year", pnSYear);

    }

    public void actionFrom(ActionEvent ac) {
        setFlag(getFlag() + 1);
        System.out.println("------------pnSYear--" + pnFA000F);
        SessionProvider.setSessionMapValue("tour_from", pnFA000F);

    }

    public void actionTo(ActionEvent ac) {
        setFlag(getFlag() + 1);
        System.out.println("------------pnFA000T--" + pnFA000T);
        SessionProvider.setSessionMapValue("tour_to", pnFA000T);

    }

    public void actionPrice1(ActionEvent ac) {
        setFlag(getFlag() + 1);
        System.out.println("------------priceTour--" + priceTour);
        SessionProvider.setSessionMapValue("tour_price", priceTour);

    }

    public void actionPrice(ActionEvent ac) {
        setFlag(getFlag() + 1);
        System.out.println("------------priceTour--" + priceTour);
        SessionProvider.setSessionMapValue("tour_price", priceTour);

    }

    public void actionPricem(ActionEvent ac) {
        setFlag(getFlag() + 1);
        System.out.println("------------priceTour--" + priceTourm);
        SessionProvider.setSessionMapValue("tour_pricem", priceTourm);
        if (priceTourm != null) {
            try {
                int a = Integer.parseInt(priceTourm.toString());
                if (a <= 0) {
                    priceTour = "0";
                    SessionProvider.setSessionMapValue("tour_price", priceTour);
                }
            } catch (Exception e) {
            }
        }


    }

    /**
     * @return the listTour
     */
    public List<V050> getListTour() {
        v050Store = new V050Store();
        try {  System.out.println("------TYPESEARCH--------"+typeSearch);
            if (getFlag() == 0) {
                if (linklistTour != null) {
                    listTour = v050Store.getListAllV050CODE(getLogin().getModule(), getLogin().getCompanyNo(), String.valueOf(fv050), getLogin().getUserName());
                  //  listTour = v050Store.getListAllV050SGTN(getLogin().getModule(), getLogin().getCompanyNo(), fv050, null, null, null, getLogin().getUserName());
                } else {

                    if (SessionProvider.getSessionMapValue("typeSearchExx") != null) {
                        typeSearch = Util.parseInt(SessionProvider.getSessionMapValue("typeSearchExx"));
                        if (SessionProvider.getSessionMapValue("keySearchExx") != null) {
                            keySearch = SessionProvider.getSessionMapValue("keySearchExx").toString();
                        }
                        if (typeSearch == 0) {
                            if (getLogin().getNv851().equals("GIT")) {
                                listTour = v050Store.getListAllV050IO(getLogin().getModule(), getLogin().getCompanyNo(), 0, "T", "GIT", getLogin().getUserName());
                            } else if (getLogin().getNv851().equals("FIT")) {
                                listTour = v050Store.getListAllV050IO(getLogin().getModule(), getLogin().getCompanyNo(), 0, "T", "FIT", getLogin().getUserName());
                            } else {
                                listTour = v050Store.vcurpks_listoftabv050(getLogin().getModule(), getLogin().getCompanyNo(), 0, null, null, null, Offset, Limit, 0, 0, getLogin().getUserName());
                            }
                        } else if (typeSearch == 2) {
                         //   System.out.println("--------------CLICK VAO TOUR-----------");
                            listTour = v050Store.getListAllV050CODE(getLogin().getModule(), getLogin().getCompanyNo(), keySearch, getLogin().getUserName());
                             System.out.println(keySearch+"--------------CLICK VAO TOUR-----------"+listTour.size());
                        } else if (typeSearch == 1) {
                            listTour = v050Store.getListAllV050NAME(getLogin().getModule(), getLogin().getCompanyNo(), keySearch, getLogin().getUserName());
                        } else if (typeSearch == 3) {
                            listTour = v050Store.getListAllV050IO(getLogin().getModule(), getLogin().getCompanyNo(), 0, "T", "GIT", getLogin().getUserName());
                        } else if (typeSearch == 4) {
                            listTour = v050Store.getListAllV050IO(getLogin().getModule(), getLogin().getCompanyNo(), 0, "T", "FIT", getLogin().getUserName());
                        } else if (typeSearch == 5) {
                            listTour = v050Store.getListAllV050ALL(getLogin().getModule(), getLogin().getCompanyNo(), getLogin().getUserName());
                        } else if (typeSearch == 6) {
                            listTour = v050Store.getListAllV050STATUS(getLogin().getModule(), getLogin().getCompanyNo(), "OP", getLogin().getUserName());
                        } else if (typeSearch == 7) {
                            listTour = v050Store.getListAllV050STATUS(getLogin().getModule(), getLogin().getCompanyNo(), "CC", getLogin().getUserName());
                        } else if (typeSearch ==100) {
                            if(SessionProvider.getSessionMapValue("STRINGSTATUSVV065")!=null){
                                VV065 = SessionProvider.getSessionMapValue("STRINGSTATUSVV065").toString();
                                System.out.println("------------TIM KIEM TRANG THAI------"+VV065);
                            }
                            
                            listTour = v050Store.getListAllV050STATUS(getLogin().getModule(), getLogin().getCompanyNo(), VV065, getLogin().getUserName());
                        }
                       
                    } else {
                        listTour = v050Store.vcurpks_listoftabv050new(getLogin().getModule(), getLogin().getCompanyNo(),fv050,fs200, fk100, VV065, null, null, Offset, Limit,  0, 0, getLogin().getUserName());
                        if(listTour.size() > 0){
                            SessionProvider.setSessionMapValue("LISTV050ROOM", listTour);
                        }
                        // listTour = v050Store.getListAllV050SGTN(getLogin().getModule(), getLogin().getCompanyNo(), 0, null, null, null, getLogin().getUserName());
                    }
                }

            } else {
                if (SessionProvider.getSessionMapValue("tour_day") != null) {
                    pnSDate = Integer.parseInt(SessionProvider.getSessionMapValue("tour_day").toString());
                }
                if (SessionProvider.getSessionMapValue("tour_month") != null) {
                    pnSMonth = Integer.parseInt(SessionProvider.getSessionMapValue("tour_month").toString());
                }
                if (SessionProvider.getSessionMapValue("tour_year") != null) {
                    pnSYear = Integer.parseInt(SessionProvider.getSessionMapValue("tour_year").toString());
                }
                if (SessionProvider.getSessionMapValue("tour_from") != null) {
                    pnFA000F = Integer.parseInt(SessionProvider.getSessionMapValue("tour_from").toString());
                }
                if (SessionProvider.getSessionMapValue("tour_to") != null) {
                    pnFA000T = Integer.parseInt(SessionProvider.getSessionMapValue("tour_to").toString());
                }
                if (SessionProvider.getSessionMapValue("tour_price") != null) {
                    priceTour = SessionProvider.getSessionMapValue("tour_price").toString();
                    pnVN055 = Integer.parseInt(priceTour);
                }
                if (SessionProvider.getSessionMapValue("tour_pricem") != null) {
                    priceTourm = SessionProvider.getSessionMapValue("tour_pricem").toString();
                    pnVN059 = Integer.parseInt(priceTourm);
                }
                if (SessionProvider.getSessionMapValue("tour_InOut") != null) {
                    pnVN079 = Integer.parseInt(SessionProvider.getSessionMapValue("tour_InOut").toString());
                }
                if (SessionProvider.getSessionMapValue("n750Tour") != null) {
                    n750 = Integer.parseInt(SessionProvider.getSessionMapValue("n750Tour").toString());
                }

                //kiem tra gia 
                if (pnVN055 < 0) {
                    pnVN059 = -pnVN055;
                    pnVN055 = 0;
                }
                if (pnVN059 < 0) {
                    pnVN055 = -pnVN059;
                    pnVN059 = 0;
                }
                listTour = v050Store.getListSearchV050A(getLogin().getModule(), getLogin().getCompanyNo(),
                        pnSDate,
                        pnSMonth,
                        pnSYear,
                        pnFA000F,
                        pnFA000T,
                        n750,
                        pnVN055,
                        pnVN059,
                        pnVN079,
                        getLogin().getUserName());
            }
            V050 v050;
            if (Offset == 0) {
                if (listTour.size() > 0) {
                    v050 = listTour.get(0);
                    if (v050 != null) {
                        SessionProvider.setSessionMapValue("totalcurentTOUR", listTour.size());
                    } else {
                        SessionProvider.setSessionMapValue("totalcurentTOUR", 0);
                    }
                } else {
                    SessionProvider.setSessionMapValue("totalcurentTOUR", 0);
                }
            }
        } catch (Exception e) {
            System.out.println("D:- Error from: getListTour : " + e.getMessage());
            listTour = new ArrayList<V050>();
        }

        //paging
        int t;
        Object obj = SessionProvider.getSessionMapValue("totalcurentTOUR");
        if (obj != null) {
            try {
                t = Integer.parseInt(obj.toString());
            } catch (Exception e) {
                t = 0;
            }
            totalcurent = t;
        } else {
            totalcurent = 0;
        }

        setTotalrow(totalcurent);
        return listTour;
    }

    /**
     * @param listTour the listTour to set
     */
    public void setListTour(List<V050> listTour) {
        this.listTour = listTour;
    }

    /**
     * @return the vv071
     */
    public String getVv071() {
        return vv071;
    }

    /**
     * @param vv071 the vv071 to set
     */
    public void setVv071(String vv071) {
        this.vv071 = vv071;
    }

    /**
     * @return the keySearch
     */
    public String getKeySearch() {
        return keySearch;
    }

    /**
     * @param keySearch the keySearch to set
     */
    public void setKeySearch(String keySearch) {
        this.keySearch = keySearch;
    }

    /**
     * @return the status
     */
    public String getStatus() {
        Object objstt = SessionProvider.getSessionMapValue("status");
        if (objstt != null) {
            status = objstt.toString().trim();
        }
        return status;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(String status) {
        this.status = status;
    }

    /**
     * @return the fv051
     */
    public String getFv051() {
        return fv051;
    }

    /**
     * @param fv051 the fv051 to set
     */
    public void setFv051(String fv051) {
        this.fv051 = fv051;
    }

    /**
     * @return the listsupplierofserviceprice
     */
    public List<V220> getListsupplierofserviceprice() {
        return listsupplierofserviceprice;
    }

    /**
     * @param listsupplierofserviceprice the listsupplierofserviceprice to set
     */
    public void setListsupplierofserviceprice(List<V220> listsupplierofserviceprice) {
        this.listsupplierofserviceprice = listsupplierofserviceprice;
    }

    /**
     * @return the itemser
     */
    public int getItemser() {
        return itemser;
    }

    /**
     * @param itemser the itemser to set
     */
    public void setItemser(int itemser) {
        this.itemser = itemser;
    }

    /**
     * @return the iditemCC
     */
    public int getIditemCC() {
        if (SessionProvider.getSessionMapValue("NCC") != null) {
            iditemCC = Util.parseInt(SessionProvider.getSessionMapValue("NCC"));
        }
        return iditemCC;
    }

    /**
     * @param iditemCC the iditemCC to set
     */
    public void setIditemCC(int iditemCC) {
        this.iditemCC = iditemCC;
    }

    /**
     * @return the listComboV220
     */
    public List<SelectItem> getListComboV220() {
        return listComboV220;
    }

    /**
     * @param listComboV220 the listComboV220 to set
     */
    public void setListComboV220(List<SelectItem> listComboV220) {
        this.listComboV220 = listComboV220;
    }

    /**
     * @return the vn072
     */
    public int getVn072() {
        return vn072;
    }

    /**
     * @param vn072 the vn072 to set
     */
    public void setVn072(int vn072) {
        this.vn072 = vn072;
    }

    /**
     * @return the vd073
     */
    public Date getVd073() {
        return vd073;
    }

    /**
     * @param vd073 the vd073 to set
     */
    public void setVd073(Date vd073) {
        this.vd073 = vd073;
    }

    /**
     * @return the vd074
     */
    public Date getVd074() {
        return vd074;
    }

    /**
     * @param vd074 the vd074 to set
     */
    public void setVd074(Date vd074) {
        this.vd074 = vd074;
    }

    /**
     * @return the listSelectN100
     */
    public List<N100> getListSelectN100() {
        return listSelectN100;
    }

    /**
     * @param listSelectN100 the listSelectN100 to set
     */
    public void setListSelectN100(List<N100> listSelectN100) {
        this.listSelectN100 = listSelectN100;
    }

    /**
     * @return the pn100
     */
    public int getPn100() {
        return pn100;
    }

    /**
     * @param pn100 the pn100 to set
     */
    public void setPn100(int pn100) {
        this.pn100 = pn100;
    }

    /**
     * @return the flagaddTour
     */
    public String getFlagaddTour() {
        return flagaddTour;
    }

    /**
     * @param flagaddTour the flagaddTour to set
     */
    public void setFlagaddTour(String flagaddTour) {
        this.flagaddTour = flagaddTour;
    }

    /**
     * @param listVersionTour the listVersionTour to set
     */
    /**
     * @return the Offset
     */
    public int getOffset() {
        return Offset;
    }

    /**
     * @param Offset the Offset to set
     */
    public void setOffset(int Offset) {
        this.Offset = Offset;
    }

    /**
     * @return the Limit
     */
    public int getLimit() {
        return Limit;
    }

    /**
     * @param Limit the Limit to set
     */
    public void setLimit(int Limit) {
        this.Limit = Limit;
    }

    // property for paging
    /**
     * @return the current
     */
    public int getCurrent() {
        if (current > totalpage) {
            current = totalpage;
        } else if (current < 1) {
            current = 1;
        }
        return current;
    }

    /**
     * @param current the current to set
     */
    public void setCurrent(int current) {

        start = (current - 1) * getNumrow();
        end = current * numrow;
        this.current = current;
    }

    /**
     * @return the numrow
     */
    public int getNumrow() {
        if (numrow == 0) {
            numrow = 30;
        }
        return numrow;
    }

    /**
     * @param numrow the numrow to set
     */
    public void setNumrow(int numrow) {
        this.numrow = numrow;
    }

    /**
     * @return the start
     */
    public int getStart() {
        if (start == 0) {
            start = 1;
        }
        return start;
    }

    /**
     * @param start the start to set
     */
    public void setStart(int start) {
        this.start = start;
    }

    /**
     * @return the end
     */
    public int getEnd() {
        if (end == 0) {
            end = 20;
        }
        return end;
    }

    /**
     * @param end the end to set
     */
    public void setEnd(int end) {
        this.end = end;
    }

    /**
     * @return the totalrow
     */
    public int getTotalrow() {
        return totalrow;
    }

    /**
     * @param totalrow the totalrow to set
     */
    public void setTotalrow(int totalrow) {
//        if (totalrow == 0) {
//            totalrow = 100;
//        }
        totalpage = totalrow / numrow;

        if (totalrow % numrow > 0) {
            totalpage = totalpage + 1;
        }


        if (getTotalpage() <= 10) {
            setStartpage(1);
            setEndpage(getTotalpage());

        } else {
            setStartpage(current - 5);
            setEndpage(current + 5);


        }
        this.totalrow = totalrow;
    }

    /**
     * @return the startpage
     */
    public int getStartpage() {
        if (startpage < 1) {
            startpage = 1;
        }
        return startpage;
    }

    /**
     * @param startpage the startpage to set
     */
    public void setStartpage(int startpage) {
        this.startpage = startpage;
    }

    /**
     * @return the endpage
     */
    public int getEndpage() {
        if (endpage > totalpage) {
            endpage = totalpage;
        }
        return endpage;
    }

    /**
     * @param endpage the endpage to set
     */
    public void setEndpage(int endpage) {

        this.endpage = endpage;
    }

    /**
     * @return the totalpage
     */
    public int getTotalpage() {
//        if (totalpage == 0) {
//            totalpage = 10;
//        }
        return totalpage;
    }

    /**
     * @param totalpage the totalpage to set
     */
    public void setTotalpage(int totalpage) {
        this.totalpage = totalpage;
    }

    /**
     * @return the pagename
     */
    public String getPagename() {
        return pagename;
    }

    /**
     * @param pagename the pagename to set
     */
    public void setPagename(String pagename) {
        this.pagename = pagename;
    }

    /**
     * @return the totalcurent
     */
    public int getTotalcurent() {
        return totalcurent;
    }

    /**
     * @param totalcurent the totalcurent to set
     */
    public void setTotalcurent(int totalcurent) {
        this.totalcurent = totalcurent;
    }

    /**
     * @return the cbxA000F
     */
    public List<SelectItem> getCbxA000F() {
        try {
            cbxA000F = comBoboxUtil.getListCombA000_SP(0);
        } catch (Exception e) {
            cbxA000F = new ArrayList<SelectItem>();
        }
        SelectItem item = new SelectItem("0", "Tất cả");
        cbxA000F.add(0, item);
        return cbxA000F;
    }

    /**
     * @param cbxA000F the cbxA000F to set
     */
    public void setCbxA000F(List<SelectItem> cbxA000F) {
        this.cbxA000F = cbxA000F;
    }

    /**
     * @return the cbxA000T
     */
    public List<SelectItem> getCbxA000T() {
        try {

            int f = 0;
            System.out.println("D:- vn079: " + pnVN079);
            Object obj = SessionProvider.getSessionMapValue("tour_InOut");
            if (obj != null) {
                System.out.println("D:- vn079ss" + obj.toString());
                try {
                    f = Integer.parseInt(obj.toString());
                } catch (Exception e) {
                }
            }

            if (f == 0) {
                cbxA000T = comBoboxUtil.getListCombA000DV(1);

            } else {
                Object o = SessionProvider.getSessionMapValue("n750Tour");
                if (o != null) {
                    try {
                        n750 = Integer.parseInt(o.toString());
                    } catch (Exception e) {
                        n750 = 0;
                    }
                }
//                cbxA000T = comBoboxUtil.getListCombA000_SP(n750);
                cbxA000T = comBoboxUtil.getListCombA000DV(n750);
            }
        } catch (Exception e) {
            System.out.println("D:- error from getCbxA000T (diem ket thuc) : " + e.getMessage());
            cbxA000T = new ArrayList<SelectItem>();
        }

        return cbxA000T;
    }

    /**
     * @param cbxA000T the cbxA000T to set
     */
    public void setCbxA000T(List<SelectItem> cbxA000T) {
        this.cbxA000T = cbxA000T;
    }

    /**
     * @return the cbxDays
     */
    public List<SelectItem> getCbxDays() {
        try {
            cbxDays = comBoboxUtil.getListDates();
        } catch (Exception e) {
            cbxDays = new ArrayList<SelectItem>();
        }

        return cbxDays;
    }

    /**
     * @param cbxDays the cbxDays to set
     */
    public void setCbxDays(List<SelectItem> cbxDays) {
        this.cbxDays = cbxDays;
    }

    /**
     * @return the cbxMonths
     */
    public List<SelectItem> getCbxMonths() {
        try {
            cbxMonths = comBoboxUtil.getListMonths();
        } catch (Exception e) {
            cbxMonths = new ArrayList<SelectItem>();
        }
        return cbxMonths;
    }

    /**
     * @param cbxMonths the cbxMonths to set
     */
    public void setCbxMonths(List<SelectItem> cbxMonths) {
        this.cbxMonths = cbxMonths;
    }

    /**
     * @return the cbxYears
     */
    public List<SelectItem> getCbxYears() {
        try {
            cbxYears = comBoboxUtil.getListYears();
        } catch (Exception e) {
            cbxYears = new ArrayList<SelectItem>();
        }
        return cbxYears;
    }

    /**
     * @param cbxYears the cbxYears to set
     */
    public void setCbxYears(List<SelectItem> cbxYears) {
        this.cbxYears = cbxYears;
    }

    /**
     * @return the pnSDate
     */
    public int getPnSDate() {
        return pnSDate;
    }

    /**
     * @param pnSDate the pnSDate to set
     */
    public void setPnSDate(int pnSDate) {
        this.pnSDate = pnSDate;
    }

    /**
     * @return the pnSMonth
     */
    public int getPnSMonth() {
        return pnSMonth;
    }

    /**
     * @param pnSMonth the pnSMonth to set
     */
    public void setPnSMonth(int pnSMonth) {
        this.pnSMonth = pnSMonth;
    }

    /**
     * @return the pnSYear
     */
    public int getPnSYear() {
        return pnSYear;
    }

    /**
     * @param pnSYear the pnSYear to set
     */
    public void setPnSYear(int pnSYear) {
        this.pnSYear = pnSYear;
    }

    /**
     * @return the pnFA000F
     */
    public int getPnFA000F() {
        return pnFA000F;
    }

    /**
     * @param pnFA000F the pnFA000F to set
     */
    public void setPnFA000F(int pnFA000F) {
        this.pnFA000F = pnFA000F;
    }

    /**
     * @return the pnFA000T
     */
    public int getPnFA000T() {
        return pnFA000T;
    }

    /**
     * @param pnFA000T the pnFA000T to set
     */
    public void setPnFA000T(int pnFA000T) {
        this.pnFA000T = pnFA000T;
    }

    /**
     * @return the pnFN750
     */
    public int getPnFN750() {
        return pnFN750;
    }

    /**
     * @param pnFN750 the pnFN750 to set
     */
    public void setPnFN750(int pnFN750) {
        this.pnFN750 = pnFN750;
    }

    /**
     * @return the pnVN055
     */
    public int getPnVN055() {
        return pnVN055;
    }

    /**
     * @param pnVN055 the pnVN055 to set
     */
    public void setPnVN055(int pnVN055) {
        this.pnVN055 = pnVN055;
    }

    /**
     * @return the pnVN059
     */
    public int getPnVN059() {
        return pnVN059;
    }

    /**
     * @param pnVN059 the pnVN059 to set
     */
    public void setPnVN059(int pnVN059) {
        this.pnVN059 = pnVN059;
    }

    /**
     * @return the pnVN079
     */
    public int getPnVN079() {
        return pnVN079;
    }

    /**
     * @param pnVN079 the pnVN079 to set
     */
    public void setPnVN079(int pnVN079) {
        this.pnVN079 = pnVN079;
    }

    /**
     * @return the priceTour
     */
    public String getPriceTour() {
        Object obj = SessionProvider.getSessionMapValue("tour_price");
        if (obj != null) {
            try {
                priceTour = obj.toString();
            } catch (Exception e) {
            }

        }
        return priceTour;
    }

    /**
     * @param priceTour the priceTour to set
     */
    public void setPriceTour(String priceTour) {
        this.priceTour = priceTour;
    }

    /**
     * @return the flag
     */
    public int getFlag() {
        return flag;
    }

    /**
     * @param flag the flag to set
     */
    public void setFlag(int flag) {
        this.flag = flag;
    }

    /**
     * @return the cbxPrice
     */
    public List<SelectItem> getCbxPrice() {
        Object obj = SessionProvider.getSessionMapValue("tour_pricem");
        System.out.println("D:- tour_pricem: " + obj);
        if (obj != null) {
            int price = 0;
            try {
                price = Integer.parseInt(obj.toString());
            } catch (Exception e) {
            }
            if (price <= 0) {
                SelectItem a1 = new SelectItem("0", "Tất cả ");
                SelectItem a2 = new SelectItem("-1000000", " Dưới 1,000,000");
                cbxPrice.add(a1);
                cbxPrice.add(a2);
                for (int i = 1; i <= 30; i++) {
                    SelectItem a = new SelectItem(i + "000000", i + ",000,000");
                    cbxPrice.add(a);
                }
            } else {
                SelectItem a1 = new SelectItem("0", "Tất cả ");
                SelectItem a2 = new SelectItem("-1000000", " Dưới 1,000,000");
                cbxPrice.add(a1);
                cbxPrice.add(a2);
                for (int i = 1; i <= 30; i++) {
                    SelectItem a = new SelectItem(i + "000000", i + ",000,000");
                    cbxPrice.add(a);
                }
//                selectItem.getSelectedRecord().getAttributeAsInt("id");

            }
        } else {

            SelectItem a1 = new SelectItem("0", "Tất cả ");
            SelectItem a2 = new SelectItem("-1000000", " Dưới 1,000,000");
            cbxPrice.add(a1);
            cbxPrice.add(a2);
            for (int i = 1; i <= 30; i++) {
                SelectItem a = new SelectItem(i + "000000", i + ",000,000");
                cbxPrice.add(a);
            }
        }





        return cbxPrice;
    }

    /**
     * @param cbxPrice the cbxPrice to set
     */
    public void setCbxPrice(List<SelectItem> cbxPrice) {
        this.cbxPrice = cbxPrice;
    }

    /**
     * @return the combN750
     */
    public List<SelectItem> getCombN750() {
        int f = 0;
        System.out.println("D:- vn079: " + pnVN079);
        Object obj = SessionProvider.getSessionMapValue("tour_InOut");
        if (obj != null) {
            System.out.println("D:- vn079ss" + obj.toString());
            try {
                f = Integer.parseInt(obj.toString());
            } catch (Exception e) {
            }
        }

        if (f == 0) {
            SelectItem item = new SelectItem("1", "Viet Nam");
            combN750.add(item);
        } else {
            ComboboxUtil combo = new ComboboxUtil();
            combN750 = combo.getlistCombN750DVT();

        }

        return combN750;
    }

    /**
     * @param combN750 the combN750 to set
     */
    public void setCombN750(List<SelectItem> combN750) {
        this.combN750 = combN750;
    }

    /**
     * @return the n750
     */
    public int getN750() {
        return n750;
    }

    /**
     * @param n750 the n750 to set
     */
    public void setN750(int n750) {
        this.n750 = n750;
    }

    /**
     * @return the cbxPricem
     */
    public List<SelectItem> getCbxPricem() {
        Object obj = SessionProvider.getSessionMapValue("tour_price");
//        Object objm = SessionProvider.getSessionMapValue("tour_pricem");

        if (obj != null) {
            int price = 0;
            try {
                price = Integer.parseInt(obj.toString());
            } catch (Exception e) {
            }

            if (price == 0) {
                setPriceTourm("0");
                SessionProvider.setSessionMapValue("tour_pricem", "0");
                SelectItem a1 = new SelectItem("0", "Tất cả ");
                cbxPricem.add(a1);
                SelectItem a2 = new SelectItem("-30000000", " Trên 30,000,000");
                cbxPricem.add(a2);

            } else if (price < 0) {
                setPriceTourm("0");
                SessionProvider.setSessionMapValue("tour_pricem", "0");
                SelectItem a1 = new SelectItem("0", "Tất cả ");
                cbxPricem.add(a1);
                SelectItem a2 = new SelectItem("-30000000", " Trên 30,000,000");
                cbxPricem.add(a2);

            } else {
                int j = 1;
                for (int i = 1; i <= 30; i++) {
                    if (price / 1000000 < i) {
                        if (j == 1) {
                            setPriceTourm(i + "000000");
                            SessionProvider.setSessionMapValue("tour_pricem", i + "000000");
                            j = 0;
                        }

                        SelectItem a = new SelectItem(i + "000000", i + ",000,000");
                        cbxPricem.add(a);
                    }

                }
                SelectItem a2 = new SelectItem("-30000000", " Trên 30,000,000");
                cbxPricem.add(a2);
            }
        } else {
            SelectItem a1 = new SelectItem("0", "Tất cả ");
            cbxPricem.add(a1);
            SelectItem a2 = new SelectItem("-30000000", " Trên 30,000,000");
            cbxPricem.add(a2);
        }

//        SelectItem a1 = new SelectItem("0", "Tất cả ");
//        cbxPricem.add(a1);
//        for (int i = 1; i <= 30; i++) {
//            SelectItem a = new SelectItem(i + "000000", i + ",000,000");
//            cbxPricem.add(a);
//        }
//        SelectItem a2 = new SelectItem("-30000000", " Trên 30,000,000");
//        cbxPricem.add(a2);

        return cbxPricem;
    }

    /**
     * @return the priceTourm
     */
    public String getPriceTourm() {

        return priceTourm;
    }

    /**
     * @param priceTourm the priceTourm to set
     */
    public void setPriceTourm(String priceTourm) {
        this.priceTourm = priceTourm;
    }

    /**
     * @return the show
     */
    public Boolean getShow() {
        return show;
    }

    /**
     * @param show the show to set
     */
    public void setShow(Boolean show) {
        this.show = show;
    }

    /**
     * @return the showm
     */
    public Boolean getShowm() {
        return showm;
    }

    /**
     * @param showm the showm to set
     */
    public void setShowm(Boolean showm) {
        this.showm = showm;
    }
    //xuat excel

    public void exportExcel() {
        //String path = "E:\\qapi\\build\\web\\resources\\excel" + "\\report.xls";
        String s = getRequest().getRequestURL().toString();
        String[] arr = new String[20];
        arr = s.split("/");
        String url = "";
        if (arr.length > 3) {
            url = arr[0] + "/" + arr[1] + "/" + arr[2] + "/";
        }
        try {


            HSSFCellStyle styleTitle = (HSSFCellStyle) wb.createCellStyle();
            styleTitle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
            styleTitle.setAlignment(CellStyle.ALIGN_CENTER);
            styleTitle.setWrapText(true);
            HSSFFont font = (HSSFFont) wb.createFont();
            font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
            font.setFontHeightInPoints((short) 12);
            font.setFontName("Arial");

            styleTitle.setFont(font);

            HSSFCellStyle styleHeader = (HSSFCellStyle) wb.createCellStyle();
            styleHeader.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
            styleHeader.setAlignment(CellStyle.ALIGN_CENTER);
            styleHeader.setWrapText(true);
            styleHeader.setFillForegroundColor(HSSFColor.ROYAL_BLUE.index);
            styleHeader.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
            styleHeader.setBorderBottom(HSSFCellStyle.BORDER_THIN);
            styleHeader.setBorderLeft(HSSFCellStyle.BORDER_THIN);
            styleHeader.setBorderRight(HSSFCellStyle.BORDER_THIN);
            styleHeader.setBorderTop(HSSFCellStyle.BORDER_THIN);

            HSSFFont font2 = (HSSFFont) wb.createFont();
            font2.setFontName("Arial");
            font2.setFontHeightInPoints((short) 10);
            font2.setFontHeightInPoints((short) 10);
            styleHeader.setFont(font2);


            HSSFCellStyle styleLeft = (HSSFCellStyle) wb.createCellStyle();
            styleLeft.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
            styleLeft.setAlignment(CellStyle.ALIGN_LEFT);
            styleLeft.setBorderBottom(HSSFCellStyle.BORDER_THIN);
            styleLeft.setBorderLeft(HSSFCellStyle.BORDER_THIN);
            styleLeft.setBorderRight(HSSFCellStyle.BORDER_THIN);
            styleLeft.setWrapText(true);

            HSSFCellStyle styleCenter = (HSSFCellStyle) wb.createCellStyle();
            styleCenter.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
            styleCenter.setAlignment(CellStyle.ALIGN_CENTER);
            styleCenter.setBorderBottom(HSSFCellStyle.BORDER_THIN);
            styleCenter.setBorderLeft(HSSFCellStyle.BORDER_THIN);
            styleCenter.setBorderRight(HSSFCellStyle.BORDER_THIN);
            styleCenter.setWrapText(true);

            HSSFCellStyle styleRight = (HSSFCellStyle) wb.createCellStyle();
            styleRight.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
            styleRight.setAlignment(CellStyle.ALIGN_RIGHT);
            styleRight.setBorderBottom(HSSFCellStyle.BORDER_THIN);
            styleRight.setBorderLeft(HSSFCellStyle.BORDER_THIN);
            styleRight.setBorderRight(HSSFCellStyle.BORDER_THIN);
            styleRight.setWrapText(true);
//            HSSFFont font3 = (HSSFFont) wb.createFont();
//            font3.setFontName("Arial");
//            font3.setFontHeightInPoints((short) 10);
//
//            styleHeader.setFont(font3);


            Sheet sheet = wb.createSheet("KH theo tour");

            Row rowTitle = sheet.createRow(currentRow);
            //new Region(currentRow,(short)0,currentRow,(short)10
            sheet.addMergedRegion(new CellRangeAddress(currentRow, currentRow, 0, 5));
            Cell cellTitle = rowTitle.createCell(0, 4);
            cellTitle.setCellValue("Danh sách tour");
            cellTitle.setCellStyle(styleTitle);

            currentRow = currentRow + 2;


            sheet = createHeader(sheet, currentRow, styleHeader);
            currentRow++;
            sheet = createContent(sheet, currentRow, styleLeft, styleCenter, styleRight);




            String tempStr = ResourcesProvider.getReportExcel();
            if (!(new File(tempStr)).exists()) {
                (new File(tempStr)).mkdirs();
            }
            //setup print
            PrintSetup ps = sheet.getPrintSetup();
            sheet.setAutobreaks(true);
            sheet.setMargin(Sheet.LeftMargin, 0.5);
            sheet.setMargin(Sheet.RightMargin, 0.5);

            ps.setLandscape(true);
            ps.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE);
            ps.setFitWidth((short) 0);
            ps.setFitHeight((short) 0);
            //end setup print

            File fileout = new File(ResourcesProvider.getReportExcel() + "report.xls");
            FileOutputStream fileOut = new FileOutputStream(fileout);
            wb.write(fileOut);
            fileOut.close();

            sendRedirect(url + "resources/excel/report.xls");

            System.out.println("sendRedirect----:" + ResourcesProvider.getReportExcel() + "report.xls");
//            sendRedirect("E://Q_//kapi//build//web//resources//excel//" + "report.xls");

        } catch (Exception e) {
        }




    }

    private Sheet createHeader(Sheet sheet, int row, HSSFCellStyle style) {
        List<SelectItem> header = new ArrayList<SelectItem>();
        header.add(new SelectItem(3000, "Mã tour"));
        header.add(new SelectItem(5000, "Tên tour"));
        header.add(new SelectItem(2000, "SL tối đa"));
        header.add(new SelectItem(2000, "SL tham gia"));
        header.add(new SelectItem(3000, "Giá bán"));
        header.add(new SelectItem(2000, "Ngoại tệ"));
        header.add(new SelectItem(2000, "Ngày bay"));
        header.add(new SelectItem(2000, "Ngày về"));
        header.add(new SelectItem(2000, "Giờ bay"));
        header.add(new SelectItem(2000, "Giờ đến"));
        header.add(new SelectItem(3000, "Điểm khởi hành"));
        header.add(new SelectItem(3000, "Điểm đến"));
        header.add(new SelectItem(12000, "Mô tả"));
        header.add(new SelectItem(3000, "Trạng thái"));
        header.add(new SelectItem(8000, "Thời gian cập nhật"));
        Row row_header = sheet.createRow(row);
        for (int i = 0; i < header.size(); i++) {
            Cell c = row_header.createCell(i);
            c.setCellValue(header.get(i).getLabel());
            c.setCellStyle(style);
            sheet.setColumnWidth(i, Integer.parseInt(header.get(i).getValue().toString()));
        }
        return sheet;
    }

    private Sheet createContent(Sheet sheet, int row, HSSFCellStyle left, HSSFCellStyle center, HSSFCellStyle right) {
        try {

            lstExportExcel = getListTour();
            System.out.println("D:- danh sach tour exportexxcel: " + lstExportExcel.size());
            for (int i = 0; i < lstExportExcel.size(); i++) {
                try {
                    V050 v050 = lstExportExcel.get(i);
                    Row r = sheet.createRow(row);//ma tour
                    Cell c = r.createCell(0);
                    if (v050.getVv051() != null) {
                        c.setCellValue(v050.getVv051());
                    }
                    c.setCellStyle(center);
                    //ten tour
                    Cell c1 = r.createCell(1);
                    if (v050.getVv052() != null) {
                        c1.setCellValue(v050.getVv052());
                    }
                    c1.setCellStyle(left);
                    //sl toi da
                    Cell c2 = r.createCell(2);
                    c2.setCellValue(v050.getVn072());
                    c2.setCellStyle(center);
                    //sl tham gia
                    Cell c3 = r.createCell(3);
                    c3.setCellValue(v050.getCount());
                    c3.setCellStyle(center);
                    //gia ban
                    Cell c4 = r.createCell(4);
                    c4.setCellValue(v050.getVn055st());
                    c4.setCellStyle(right);
                    //ngoai tệ
                    Cell c5 = r.createCell(5);
                    c5.setCellValue("VND");
                    c5.setCellStyle(center);
                    //ngày bay
                    Cell c6 = r.createCell(6);
                    try {
                        c6.setCellValue(sdf.format(Util.toSQLDate(v050.getVd073())));
                    } catch (Exception e) {
                    }
                    c6.setCellStyle(center);
                    //ngay ve
                    Cell c7 = r.createCell(7);
                    if (v050.getVd074() != null) {
                        try {
                            c7.setCellValue(sdf.format(Util.toSQLDate(v050.getVd074())));
                        } catch (Exception e) {
                        }
                        c7.setCellValue(v050.getVd074());
                    }
                    c7.setCellStyle(center);
                    //gio bay
                    Cell c8 = r.createCell(8);
                    if (v050.getVn075() > 9 && v050.getVn076() > 9) {
                        c8.setCellValue(v050.getVn075() + " : " + v050.getVn076());
                    } else if (v050.getVn075() < 9 && v050.getVn076() > 9) {
                        c8.setCellValue("0" + v050.getVn075() + " : " + v050.getVn076());
                    } else if (v050.getVn075() > 9 && v050.getVn076() < 9) {
                        c8.setCellValue(v050.getVn075() + " : 0" + v050.getVn076());
                    }


                    c8.setCellStyle(center);
                    //gio den

                    Cell c9 = r.createCell(9);
                    if (v050.getVn077() > 9 && v050.getVn078() > 9) {
                        c8.setCellValue(v050.getVn077() + " : " + v050.getVn078());
                    } else if (v050.getVn077() < 9 && v050.getVn078() > 9) {
                        c9.setCellValue("0" + v050.getVn077() + " : " + v050.getVn078());
                    } else if (v050.getVn077() > 9 && v050.getVn078() < 9) {
                        c9.setCellValue(v050.getVn077() + " : 0" + v050.getVn078());
                    }
                    c8.setCellStyle(center);
                    //diem khoi hanh
                    Cell c10 = r.createCell(10);
                    if (v050.getAv001f() != null) {
                        c10.setCellValue(v050.getAv001f());
                    }

                    c10.setCellStyle(center);
                    //diem den
                    Cell c11 = r.createCell(11);
                    if (v050.getAv001t() != null) {
                        c11.setCellValue(v050.getAv001t());
                    }

                    c11.setCellStyle(center);
                    //mo ta
                    Cell c12 = r.createCell(12);
                    if (v050.getVv071() != null) {
                        c12.setCellValue(v050.getVv071());
                    }

                    c12.setCellStyle(left);
                    //trang thai
                    Cell c13 = r.createCell(13);
                    if (v050.getVv066() != null) {
                        if (v050.getVv066().equals("T")) {
                            c13.setCellValue("Tour");
                        } else {
                            c13.setCellValue("Sale");
                        }
                    }

                    c13.setCellStyle(center);
                    //mo ta
                    Cell c14 = r.createCell(14);
                    SimpleDateFormat sdf1 = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
                    if (v050.getVl098() != null && v050.getVl099() != null) {
                        try {
                            c14.setCellValue(sdf1.format(Util.toSQLDate(v050.getVl0981())) + v050.getVl099());
                        } catch (Exception e) {
                            c14.setCellValue(v050.getVl099());

                        }
                    }

                    c14.setCellStyle(center);
                    row++;
                } catch (Exception e) {
                    System.out.println("D:-error from  row: " + i + " -- " + e.getMessage());
                    continue;
                }

            }
        } catch (Exception e) {
            System.out.println("D:-error from ExportExel: " + e.getMessage());
        }
        return sheet;
    }
    //end excel

    /**
     * @return the linklistTour
     */
    public String getLinklistTour() {
        return linklistTour;
    }

    /**
     * @param linklistTour the linklistTour to set
     */
    public void setLinklistTour(String linklistTour) {
        this.linklistTour = linklistTour;
    }

    /**
     * @return the idmenupersonal
     */
    public int getIdmenupersonal() {
        return idmenupersonal;
    }

    /**
     * @param idmenupersonal the idmenupersonal to set
     */
    public void setIdmenupersonal(int idmenupersonal) {
        this.idmenupersonal = idmenupersonal;
    }

    /**
     * @return the typeSearch
     */
    public int getTypeSearch() {
        return typeSearch;
    }

    /**
     * @param typeSearch the typeSearch to set
     */
    public void setTypeSearch(int typeSearch) {
        this.typeSearch = typeSearch;
    }

    /**
     * @return the hideClass
     */
    public boolean isHideClass() {
        return hideClass;
    }

    /**
     * @param hideClass the hideClass to set
     */
    public void setHideClass(boolean hideClass) {
        this.hideClass = hideClass;
    }

    /**
     * @return the hideclassAction
     */
    public int getHideclassAction() {
        //  System.out.println("----HIDE CLASS------------------AAAAAAAAAAAAAA----------------------" + hideClass);
        if (SessionProvider.getSessionMapValue("HIDECLASS") != null) {
            if (SessionProvider.getSessionMapValue("HIDECLASS").equals(true)) {
                hideclassAction = 30;
            } else {
                hideclassAction = 0;
            }

        } else {
            hideclassAction = 0;
        }
        return hideclassAction;
    }

    /**
     * @param hideclassAction the hideclassAction to set
     */
    public void setHideclassAction(int hideclassAction) {
        this.hideclassAction = hideclassAction;
    }

    /**
     * @return the hideClassCT
     */
    public boolean isHideClassCT() {
        return hideClassCT;
    }

    /**
     * @param hideClassCT the hideClassCT to set
     */
    public void setHideClassCT(boolean hideClassCT) {
        this.hideClassCT = hideClassCT;
    }

    /**
     * @return the hideclassActionCT
     */
    public int getHideclassActionCT() {
        if (SessionProvider.getSessionMapValue("HIDECLASSCT") != null) {
            if (SessionProvider.getSessionMapValue("HIDECLASSCT").equals(true)) {
                hideclassActionCT = 30;
            } else {
                hideclassActionCT = 0;
            }

        } else {
            hideclassActionCT = 0;
        }
        //  return hideclassAction;
        return hideclassActionCT;
    }

    /**
     * @param hideclassActionCT the hideclassActionCT to set
     */
    public void setHideclassActionCT(int hideclassActionCT) {
        this.hideclassActionCT = hideclassActionCT;
    }

    /**
     * @return the VV065
     */
    public String getVV065() {
        return VV065;
    }

    /**
     * @param VV065 the VV065 to set
     */
    public void setVV065(String VV065) {
        this.VV065 = VV065;
    }
}
